`getsockopt()` should be called with a pointer to the size of the
before-last argument as last argument. Since the `len` argument was
unitialized, it could be assigned to some register and initialized to
0. If this was not the case for `saved`, it was initialized to some
random value. Hence the `value > saved` value was likely to be false
and `Setsocksize()` didn't do anything.
---
src/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util.c b/src/util.c
index a03b8b8..e63e038 100644
--- a/src/util.c
+++ b/src/util.c
@@ -712,7 +712,7 @@ void mark_columns(char *buf)
int Setsocksize(int s, int level, int optname, void *optval, int optlen)
{
- int ret, len, saved, value;
+ int ret, len = sizeof(int), saved, value;
memcpy(&value, optval, sizeof(int));
--
1.7.10.4
_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists