pam: fixed data read failure

By incorporating Coverity complains, return value from fread was
incorrectly evaluated - returned nmemb=1 of size instead of size in
bytes. Reversed the order for convenience (to show actual number of
bytes, not only that 0 members were read).
This commit is contained in:
Martin Pulec
2023-02-07 16:25:49 +01:00
parent 429d27a148
commit 6a8fdff5de

View File

@@ -174,7 +174,7 @@ bool pam_read(const char *filename, struct pam_metadata *info, unsigned char **d
fclose(file);
return false;
}
size_t bytes_read = fread((char *) *data, datalen, 1, file);
size_t bytes_read = fread((char *) *data, 1, datalen, file);
if (bytes_read != datalen) {
fprintf(stderr, "Unable to load PAM/PNM data from file - read %zu B, expected %zu B: %s\n",
bytes_read, datalen, strerror(errno));