Improved parsing of some integer arguments (sizes).
[BearSSL] / tools / client.c
index 3b462a8..692b60f 100644 (file)
@@ -35,7 +35,6 @@
 #include <arpa/inet.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <sys/poll.h>
 
 #include "brssl.h"
 #include "bearssl.h"
@@ -246,7 +245,11 @@ do_client(int argc, char *argv[])
                                usage_client();
                                goto client_exit_error;
                        }
-                       iobuf_len = strtoul(arg, 0, 10);
+                       iobuf_len = parse_size(arg);
+                       if (iobuf_len == (size_t)-1) {
+                               usage_client();
+                               goto client_exit_error;
+                       }
                } else if (eqstr(arg, "-CA")) {
                        if (++ i >= argc) {
                                fprintf(stderr,