mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg-check-pattern: Consider an empty pattern file as valid
* tools/gpg-check-pattern.c (read_file): Check length before calling fread. -- The problem with an empty file is that es_fread is called to read one element of length zero which seems to be undefined behaviour and results in ENOENT on my test box.
This commit is contained in:
parent
609b1ec0c6
commit
c27534de95
@ -285,7 +285,7 @@ read_file (const char *fname, size_t *r_length)
|
||||
|
||||
buflen = st.st_size;
|
||||
buf = xmalloc (buflen+1);
|
||||
if (es_fread (buf, buflen, 1, fp) != 1)
|
||||
if (buflen && es_fread (buf, buflen, 1, fp) != 1)
|
||||
{
|
||||
log_error ("error reading '%s': %s\n", fname, strerror (errno));
|
||||
es_fclose (fp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user