From: Roy Marples Date: Thu, 8 Nov 2012 00:08:36 +0000 (+0000) Subject: We should check start len >0 as len will be zero at this point. X-Git-Tag: v5.99.3~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f9865c478f26f6d7b8c7fcf892617e348b95430;p=thirdparty%2Fdhcpcd.git We should check start len >0 as len will be zero at this point. --- diff --git a/dhcp.c b/dhcp.c index 33417467..67387522 100644 --- a/dhcp.c +++ b/dhcp.c @@ -402,11 +402,13 @@ ssize_t decode_rfc3397(char *out, ssize_t len, int pl, const uint8_t *p) { const char *start; + ssize_t start_len; const uint8_t *r, *q = p; int count = 0, l, hops; uint8_t ltype; start = out; + start_len = len; while (q - p < pl) { r = NULL; hops = 0; @@ -456,7 +458,7 @@ decode_rfc3397(char *out, ssize_t len, int pl, const uint8_t *p) if (out) { if (out != start) *(out - 1) = '\0'; - else if (len > 0) + else if (start_len > 0) *out = '\0'; }