From e6cd6a0a6a219c6f2b1c86d308618b99e83345b0 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 20 Jul 2009 09:40:32 +0200 Subject: [PATCH] src/liboping.c: Fixed argument verification. ping_iterator_get_info()'s 'buffer' argument _may_ be NULL, since the user might only be interested in the size of the (to be) returned value. If 'buffer' is NULL, '*buffer_len' should be 0, though, to make sure nothing gets written to 'buffer'. This bug was introduced in commit 9ae85a09d919777c9be52e55b23c08bf2c8c1d0e. --- src/liboping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/liboping.c b/src/liboping.c index 6950103..411d866 100644 --- a/src/liboping.c +++ b/src/liboping.c @@ -1532,7 +1532,10 @@ int ping_iterator_get_info (pingobj_iter_t *iter, int info, size_t orig_buffer_len = *buffer_len; - if ((iter == NULL) || (buffer == NULL) || (buffer_len == NULL)) + if ((iter == NULL) || (buffer_len == NULL)) + return (-1); + + if ((buffer == NULL) && (*buffer_len != 0 )) return (-1); switch (info) -- 2.30.2