Re: [OpenWrt-Devel] [PATCH] 6relayd: verify fd is valid before use

2013-10-23 Thread Steven Barth
Hello Nathan,

Thanks for your patches. I already had a quick look at them and found that i 
already addressed some of this in odhcpd which will replace 6relayd in the near 
future. I will go through the others later again.

Cheers,
Steven___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] 6relayd: verify fd is valid before use

2013-10-20 Thread Nathan Hintz
Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 src/6relayd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/6relayd.c b/src/6relayd.c
index fcfecb7..32ead14 100644
--- a/src/6relayd.c
+++ b/src/6relayd.c
@@ -403,6 +403,9 @@ int relayd_get_interface_mtu(const char *ifname)
snprintf(buf, sizeof(buf), sysctl_pattern, ifname);
 
int fd = open(buf, O_RDONLY);
+   if (fd  0)
+   return -1;
+
ssize_t len = read(fd, buf, sizeof(buf) - 1);
close(fd);
 
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel