summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2012-11-14 10:44:26 +0000
committerRoy Marples <roy@marples.name>2012-11-14 10:44:26 +0000
commitb0d47a8e49d4327805abfb329faf6f28c287fa00 (patch)
tree284b04cb5898a6aaa708bd5b5ee8104e7f209e62
parent11fe19507bf71d2ab870e51e4d0e8d111ae1aa40 (diff)
downloaddhcpcd-b0d47a8e49d4327805abfb329faf6f28c287fa00.tar.xz
We should check start len >0 as len will be zero at this point.
-rw-r--r--dhcp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dhcp.c b/dhcp.c
index da620705..ca564fcb 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -440,11 +440,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;
@@ -494,7 +496,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';
}