From: Marcus Brinkmann Date: Fri, 15 Feb 2008 23:07:29 +0000 (+0000) Subject: 2008-02-15 Marcus Brinkmann X-Git-Tag: gpgme-1.1.8~47 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8b834710797fa68c168b67df409a792af4752d88;p=gpgme.git 2008-02-15 Marcus Brinkmann * engine-gpgconf.c (gpgconf_read): Fix end-of-line handline. --- diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 9ac1f61..2a5c719 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,7 @@ +2008-02-15 Marcus Brinkmann + + * engine-gpgconf.c (gpgconf_read): Fix end-of-line handline. + 2008-02-14 Werner Koch * w32-io.c (_gpgme_io_spawn): Add arg R_PID to return the pid. diff --git a/gpgme/engine-gpgconf.c b/gpgme/engine-gpgconf.c index 26cd45f..ab03e9d 100644 --- a/gpgme/engine-gpgconf.c +++ b/gpgme/engine-gpgconf.c @@ -232,24 +232,24 @@ gpgconf_read (void *engine, char *arg1, char *arg2, nread = _gpgme_io_read (rp[0], &line[linelen], LINELENGTH - linelen - 1); if (nread > 0) { - line[linelen + nread] = '\0'; linelen += nread; + line[linelen] = '\0'; while ((mark = strchr (line, '\n'))) { char *eol = mark; - if (eol > &line[0] && *eol == '\r') + if (eol > line && eol[-1] == '\r') eol--; *eol = '\0'; - + /* Got a full line. */ err = (*cb) (hook, line); if (err) break; - linelen -= mark - line; - memmove (line, eol + 1, linelen); + linelen -= mark + 1 - line; + memmove (line, mark + 1, linelen); } } }