aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/common
diff options
context:
space:
mode:
authorToomas Soome <tsoome@FreeBSD.org>2017-03-20 22:20:17 +0000
committerToomas Soome <tsoome@FreeBSD.org>2017-03-20 22:20:17 +0000
commitc1e968fb6297591a95711fea86f694b9f3b43e88 (patch)
tree44e9263aeb4d57ee955cd5e6b765de19dac966e4 /sys/boot/common
parent98339da12a4e4255ea080b6a3913896c4587cebc (diff)
downloadsrc-c1e968fb6297591a95711fea86f694b9f3b43e88.tar.gz
src-c1e968fb6297591a95711fea86f694b9f3b43e88.zip
loader: verify the value from dhcp.interface-mtu and use snprintf to set mtu
Since the uset can set dhcp.interface-mtu, we need to try to validate the value. So we verify if the conversion to int is successful and we will not allow to set value greater than max IPv4 packet size. Also use snprintf for safety. Reviewed by: allanjude, bapt Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8492
Notes
Notes: svn path=/head/; revision=315653
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/dev_net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/boot/common/dev_net.c b/sys/boot/common/dev_net.c
index 76abb2eb50ba..1795767dc5b3 100644
--- a/sys/boot/common/dev_net.c
+++ b/sys/boot/common/dev_net.c
@@ -175,7 +175,7 @@ net_open(struct open_file *f, ...)
}
if (intf_mtu != 0) {
char mtu[16];
- sprintf(mtu, "%u", intf_mtu);
+ snprintf(mtu, sizeof(mtu), "%u", intf_mtu);
setenv("boot.netif.mtu", mtu, 1);
}