projects
/
oweals
/
odhcpd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
029123b
)
odhcpd: fix passing possible negative parameter
author
Hans Dedecker
<dedeckeh@gmail.com>
Mon, 4 Jun 2018 19:49:52 +0000
(21:49 +0200)
committer
Hans Dedecker
<dedeckeh@gmail.com>
Mon, 4 Jun 2018 19:54:57 +0000
(21:54 +0200)
Prevent passing negative argument to read; detected by Coverity in CID1412381
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/odhcpd.c
patch
|
blob
|
history
diff --git
a/src/odhcpd.c
b/src/odhcpd.c
index 0e0002d95159e402e4c004b76021312ec58c667c..7c6c144112e076efc37ac2c38bb55fb3c33ef3d5 100644
(file)
--- a/
src/odhcpd.c
+++ b/
src/odhcpd.c
@@
-128,6
+128,9
@@
int odhcpd_get_interface_config(const char *ifname, const char *what)
snprintf(buf, sizeof(buf), sysctl_pattern, ifname, what);
int fd = open(buf, O_RDONLY);
+ if (fd < 0)
+ return -1;
+
ssize_t len = read(fd, buf, sizeof(buf) - 1);
close(fd);