diff options
| author | Werner Koch <[email protected]> | 2025-11-04 08:01:21 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2025-11-04 08:31:37 +0000 |
| commit | 1b4ac98de7db6f6828b1b255ad3d4e5e7373666e (patch) | |
| tree | 12365b6b95abf7121827c1c511a096ee7c2caf10 /agent/trustlist.c | |
| parent | agent:ssh: Fix RSA signature handling for newer spec. (diff) | |
| download | gnupg-1b4ac98de7db6f6828b1b255ad3d4e5e7373666e.tar.gz gnupg-1b4ac98de7db6f6828b1b255ad3d4e5e7373666e.zip | |
agent: Accept a trustlist with a missing LF at the end.
* agent/trustlist.c (read_one_trustfile): Clear error if the last line
has no LF.
Diffstat (limited to 'agent/trustlist.c')
| -rw-r--r-- | agent/trustlist.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/agent/trustlist.c b/agent/trustlist.c index 8581cda15..bbd178ee7 100644 --- a/agent/trustlist.c +++ b/agent/trustlist.c @@ -162,6 +162,7 @@ read_one_trustfile (const char *fname, int systrust, int tableidx; size_t tablesize; int lnr = 0; + int no_trailing_lf = 0; table = *addr_of_table; tablesize = *addr_of_tablesize; @@ -182,13 +183,17 @@ read_one_trustfile (const char *fname, int systrust, n = strlen (line); if (!n || line[n-1] != '\n') { + if (n && es_feof (fp)) + no_trailing_lf = 1; /* (The next fgets will break the loop.) */ /* Eat until end of line. */ while ( (c=es_getc (fp)) != EOF && c != '\n') ; - err = gpg_error (*line? GPG_ERR_LINE_TOO_LONG + err = gpg_error (*line && !no_trailing_lf? GPG_ERR_LINE_TOO_LONG : GPG_ERR_INCOMPLETE_LINE); log_error (_("file '%s', line %d: %s\n"), fname, lnr, gpg_strerror (err)); + if (no_trailing_lf) + err = 0; /* Clear the error. */ continue; } line[--n] = 0; /* Chop the LF. */ |
