Commit 494c544f authored by Nikos Mavrogiannopoulos's avatar Nikos Mavrogiannopoulos Committed by Niels Möller

sexp-conv: ensure non-null input to strcmp() and strtol()

Signed-off-by: default avatarNikos Mavrogiannopoulos <nmav@redhat.com>
parent 13d6050c
...@@ -217,6 +217,7 @@ static int ...@@ -217,6 +217,7 @@ static int
match_argument(const char *given, const char *name) match_argument(const char *given, const char *name)
{ {
/* FIXME: Allow abbreviations */ /* FIXME: Allow abbreviations */
assert(given != NULL && name != NULL);
return !strcmp(given, name); return !strcmp(given, name);
} }
...@@ -279,7 +280,10 @@ parse_options(struct conv_options *o, ...@@ -279,7 +280,10 @@ parse_options(struct conv_options *o,
case 'w': case 'w':
{ {
char *end; char *end;
int width = strtol(optarg, &end , 0); int width;
assert(optarg != NULL);
width = strtol(optarg, &end , 0);
if (!*optarg || *end || width < 0) if (!*optarg || *end || width < 0)
die("sexp-conv: Invalid width `%s'.\n", optarg); die("sexp-conv: Invalid width `%s'.\n", optarg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment