diff options
author | Allan McRae <allan@archlinux.org> | 2015-02-25 01:01:49 +1000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-03-03 16:54:17 +1000 |
commit | 9f1c5f0251c202ad504f03464da23a5050914157 (patch) | |
tree | 3c77c5a3609913e5a0a67448364015d34b8a6ab9 | |
parent | d9b5cb238d7e1f7ec998ffd002e15cf9c1a48425 (diff) |
pacsort: test string is not NULL before strlen
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | src/util/pacsort.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/pacsort.c b/src/util/pacsort.c index 02b9084b..d864fdb9 100644 --- a/src/util/pacsort.c +++ b/src/util/pacsort.c @@ -399,9 +399,13 @@ static int vercmp(const void *p1, const void *p2) static char escape_char(const char *string) { + if(!string) { + return -1; + } + const size_t len = strlen(string); - if(!string || len > 2) { + if(len > 2) { return -1; } |