Mercurial > hg > dhcpcd
changeset 5216:7cf6e8760b69 draft
Fix an uninitialised memory access
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Tue, 12 May 2020 13:59:48 +0000 |
| parents | c246c5e40b03 |
| children | 9553b9896f29 |
| files | src/if-options.c |
| diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/if-options.c Tue May 12 13:54:19 2020 +0000 +++ b/src/if-options.c Tue May 12 13:59:48 2020 +0000 @@ -2407,10 +2407,10 @@ logerr("%s: %s", __func__, EMBEDDED_CONFIG); return ifo; } - if (buf[buflen] != '\0') { + if (buf[buflen - 1] != '\0') { if (buflen < sizeof(buf) - 1) bulen++; - buf[buflen] = '\0'; + buf[buflen - 1] = '\0'; } #else buflen = (ssize_t)strlcpy(buf, dhcpcd_embedded_conf, @@ -2489,10 +2489,10 @@ logerr("%s: %s", __func__, ctx->cffile); return ifo; } - if (buf[buflen] != '\0') { + if (buf[buflen - 1] != '\0') { if ((size_t)buflen < sizeof(buf) - 1) buflen++; - buf[buflen] = '\0'; + buf[buflen - 1] = '\0'; } dhcp_filemtime(ctx, ctx->cffile, &ifo->mtime);
