Skip to content

Commit 41c8c70

Browse files
committed
util: fix sign-conversion warning
1 parent 5f59ec7 commit 41c8c70

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

util.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,12 @@ int get_devices_from_authfile(const cfg_t *cfg, const char *username,
730730
#endif
731731
}
732732

733-
opwfile_size = st.st_size;
733+
if (st.st_size < 0) {
734+
debug_dbg(cfg, "Invalid stat size for %s: %jd", cfg->auth_file,
735+
(intmax_t) st.st_size);
736+
goto err;
737+
}
738+
opwfile_size = (size_t) st.st_size;
734739

735740
gpu_ret = getpwuid_r(st.st_uid, &pw_s, buffer, sizeof(buffer), &pw);
736741
if (gpu_ret != 0 || pw == NULL) {

0 commit comments

Comments
 (0)