mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-20 19:52:10 +00:00
Re-implement print_mac() to do its own buffer managment.
print_mac() used to output into caller-supplied buffer with no length checking. The various callers supplied different length buffers and did their own, ad-hoc, length checking before calling print_mac(). This was an accident waiting to happen and it had actually happened in couple of places, with buffer overflows possible. print_mac() now returns the address of its own buffer, which is grown as required. Thanks to Nicholas Carlini <npc@anthropic.com> for spotting this problem.
This commit is contained in:
8 files changed
+46
-49
No files matched your search
+3
-3
@@ -936,11 +936,11 @@ char *option_string(int prot, unsigned int opt, unsigned char *val, int opt_len,
|
||||
trunc = 1;
|
||||
opt_len = 14;
|
||||
}
|
||||
print_mac(buf, val, opt_len);
|
||||
|
||||
*buf = 0;
|
||||
strncat(buf, print_mac(val, opt_len), buf_len);
|
||||
if (trunc)
|
||||
strncat(buf, "...", buf_len - strlen(buf));
|
||||
|
||||
|
||||
}
|
||||
|
||||
return ot[o].name ? ot[o].name : "";
|
||||
|
||||
Reference in new issue
Block a user