[Olsr-dev] [PATCH v1 088/115] info: ipc_action: use a safer 'oversize' comparison

Ferry Huberts (spam-protected)
Wed Dec 2 21:29:01 CET 2015


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/info/olsrd_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/info/olsrd_info.c b/lib/info/olsrd_info.c
index f411d77..8af509e 100644
--- a/lib/info/olsrd_info.c
+++ b/lib/info/olsrd_info.c
@@ -350,7 +350,7 @@ static void ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int
     char requ[1024];
     ssize_t s = recv(ipc_connection, (void *) &requ, sizeof(requ) - 1, 0); /* Win32 needs the cast here */
 
-    if (s == sizeof(requ) - 1) {
+    if (s >= (ssize_t) (sizeof(requ) - 1)) {
       /* input was much too long, just skip the rest */
       while (recv(ipc_connection, (void *) &sink_buffer, sizeof(sink_buffer), 0) == sizeof(sink_buffer))
         ;
-- 
2.5.0




More information about the Olsr-dev mailing list