From 494c544f7cbe29e5f14bef9385d0a30ad454a5d9 Mon Sep 17 00:00:00 2001
From: Nikos Mavrogiannopoulos <nmav@redhat.com>
Date: Fri, 3 Jan 2020 09:57:38 +0100
Subject: [PATCH] sexp-conv: ensure non-null input to strcmp() and strtol()

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
---
 tools/sexp-conv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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);
 
-- 
GitLab