]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
sexp-conv: ensure non-null input to strcmp() and strtol()
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Fri, 3 Jan 2020 08:57:38 +0000 (09:57 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 6 Jan 2020 20:44:03 +0000 (21:44 +0100)
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
tools/sexp-conv.c

index 557b8bd752a01de72431a9ba3838ea3e2c2d7a69..e7357052218aaae821a0adaccfd0b60243171b9b 100644 (file)
@@ -217,6 +217,7 @@ static int
 match_argument(const char *given, const char *name)
 {
   /* FIXME: Allow abbreviations */
+  assert(given != NULL && name != NULL);
   return !strcmp(given, name);
 }
 
@@ -279,7 +280,10 @@ parse_options(struct conv_options *o,
        case 'w':
          {
            char *end;
-           int width = strtol(optarg, &end , 0);
+           int width;
+           assert(optarg != NULL);
+
+           width = strtol(optarg, &end , 0);
            if (!*optarg || *end || width < 0)
              die("sexp-conv: Invalid width `%s'.\n", optarg);