OSDN Git Service

net/slirp: Convert atoi to qemu_strtoi to allow error checking
authorNia Alarie <nia.alarie@gmail.com>
Fri, 16 Mar 2018 14:39:21 +0000 (14:39 +0000)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 31 May 2018 19:19:24 +0000 (21:19 +0200)
Signed-off-by: Nia Alarie <nia.alarie@gmail.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
net/slirp.c

index 005c267..1e14318 100644 (file)
@@ -492,7 +492,9 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict)
         goto fail_syntax;
     }
 
-    host_port = atoi(p);
+    if (qemu_strtoi(p, NULL, 10, &host_port)) {
+        goto fail_syntax;
+    }
 
     err = slirp_remove_hostfwd(s->slirp, is_udp, host_addr, host_port);