[SLOF] [PATCH] libnet: Fix the check of the argument lengths of the "ping" command

Thomas Huth thuth at redhat.com
Mon Aug 26 22:50:17 AEST 2019


The current if-condition can never be true.

Buglink: https://bugs.launchpad.net/qemu/+bug/1840646
Signed-off-by: Thomas Huth <thuth at redhat.com>
---
 lib/libnet/ping.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libnet/ping.c b/lib/libnet/ping.c
index 051269f..51db061 100644
--- a/lib/libnet/ping.c
+++ b/lib/libnet/ping.c
@@ -119,7 +119,7 @@ int ping(char *args_fs, int alen)
 
 	memset(&ping_args, 0, sizeof(struct ping_args));
 
-	if (alen <= 0 && alen >= sizeof(args) - 1) {
+	if (alen <= 0 || alen >= sizeof(args) - 1) {
 		usage();
 		return -1;
 	}
-- 
2.18.1



More information about the SLOF mailing list