Blame SOURCES/dnsmasq-2.66-Fix_crash_with_empty_DHCP_string_options.patch
|
|
cab8d5 |
From 625ac28c61b0a5e6a252db00d72fbac6d88718fd Mon Sep 17 00:00:00 2001
|
|
|
cab8d5 |
From: Simon Kelley <simon@thekelleys.org.uk>
|
|
|
cab8d5 |
Date: Tue, 2 Jul 2013 21:19:32 +0100
|
|
|
cab8d5 |
Subject: [PATCH] Fix crash with empty DHCP string options.
|
|
|
cab8d5 |
|
|
|
cab8d5 |
---
|
|
|
cab8d5 |
src/rfc2131.c | 3 ++-
|
|
|
cab8d5 |
1 file changed, 2 insertions(+), 1 deletions(-)
|
|
|
cab8d5 |
|
|
|
cab8d5 |
diff --git a/src/rfc2131.c b/src/rfc2131.c
|
|
|
cab8d5 |
index 499f5c4..e7fa75f 100644
|
|
|
cab8d5 |
--- a/src/rfc2131.c
|
|
|
cab8d5 |
+++ b/src/rfc2131.c
|
|
|
cab8d5 |
@@ -1833,7 +1833,8 @@ static int do_opt(struct dhcp_opt *opt, unsigned char *p, struct dhcp_context *c
|
|
|
cab8d5 |
}
|
|
|
cab8d5 |
}
|
|
|
cab8d5 |
else
|
|
|
cab8d5 |
- memcpy(p, opt->val, len);
|
|
|
cab8d5 |
+ /* empty string may be extended to "\0" by null_term */
|
|
|
cab8d5 |
+ memcpy(p, opt->val ? opt->val : (unsigned char *)"", len);
|
|
|
cab8d5 |
}
|
|
|
cab8d5 |
return len;
|
|
|
cab8d5 |
}
|
|
|
cab8d5 |
--
|
|
|
cab8d5 |
1.7.2.5
|
|
|
cab8d5 |
|