From: Roy Marples Date: Fri, 26 Sep 2014 21:13:17 +0000 (+0000) Subject: Check we are writing to a string before checking for enough space. X-Git-Tag: v6.4.6~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=100558f5c27d71a9cdbdf26ecd1d3df09df80627;p=thirdparty%2Fdhcpcd.git Check we are writing to a string before checking for enough space. --- diff --git a/dhcp-common.c b/dhcp-common.c index 1e0d1003..569766b1 100644 --- a/dhcp-common.c +++ b/dhcp-common.c @@ -331,7 +331,7 @@ print_string(char *s, size_t len, const uint8_t *data, size_t dl) } ve = svis(v, c, VIS_CSTYLE | VIS_OCTAL, data <= e ? *data : 0, ESCAPE_CHARS); - if (len < (size_t)(ve - v) + 1) { + if (s && len < (size_t)(ve - v) + 1) { errno = ENOBUFS; return -1; }