From: Roy Marples Date: Mon, 29 Sep 2014 13:24:09 +0000 (+0000) Subject: Fix bounds check. X-Git-Tag: v6.5.0~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc072ca1a82ea8606764a50e9a397505cf84d695;p=thirdparty%2Fdhcpcd.git Fix bounds check. --- diff --git a/dhcp-common.c b/dhcp-common.c index 3e356c9d..915cad47 100644 --- a/dhcp-common.c +++ b/dhcp-common.c @@ -336,11 +336,11 @@ print_string(char *s, size_t len, int flags, const uint8_t *data, size_t dl) else ve = vis(v, c, VIS_CSTYLE | VIS_OCTAL, data <= e ? *data : 0); - if (s && len < (size_t)(ve - v) + 1) { + bytes += (size_t)(ve - v); + if (s && len < bytes + 1) { errno = ENOBUFS; return -1; } - bytes += (size_t)(ve - v); if (s) { vp = v; while (vp != ve)