From: Amos Jeffries Date: Tue, 4 Jun 2013 02:59:47 +0000 (-0600) Subject: Fix string termination in snmplib X-Git-Tag: SQUID_3_4_0_1~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=268421d171fb86487ab172f9250148162239d5da;p=thirdparty%2Fsquid.git Fix string termination in snmplib strncpy() does not null-terminate if the source string is larger or equal to the destination buffer length. Detected by Coverity Scan. Issue 1025738. --- diff --git a/snmplib/parse.c b/snmplib/parse.c index 352af377a4..4cc978e249 100644 --- a/snmplib/parse.c +++ b/snmplib/parse.c @@ -690,8 +690,8 @@ parse_objectid(FILE *fp, char *name) { */ if (count == (length - 2)) { if (op->label) { - strncpy(np->parent, op->label, sizeof(np->parent)); - strncpy(np->label, name, sizeof(np->label)); + strncpy(np->parent, op->label, sizeof(np->parent)-1); + strncpy(np->label, name, sizeof(np->label)-1); if (nop->subid != -1) np->subid = nop->subid; else