summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2020-01-03 09:57:38 +0100
committerNiels Möller <nisse@lysator.liu.se>2020-01-06 21:44:03 +0100
commit494c544f7cbe29e5f14bef9385d0a30ad454a5d9 (patch)
treea826e6db7bdbb88250f6d91000f8bb718677dd9f
parent13d6050c4886de15aeb0c6867beae43826f3bd26 (diff)
downloadnettle-494c544f7cbe29e5f14bef9385d0a30ad454a5d9.tar.gz
sexp-conv: ensure non-null input to strcmp() and strtol()
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--tools/sexp-conv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/sexp-conv.c b/tools/sexp-conv.c
index 557b8bd7..e7357052 100644
--- a/tools/sexp-conv.c
+++ b/tools/sexp-conv.c
@@ -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);