diff options
author | Allan McRae <allan@archlinux.org> | 2015-02-24 16:01:49 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-03-03 07:54:17 +0100 |
commit | 9f1c5f0251c202ad504f03464da23a5050914157 (patch) | |
tree | 3c77c5a3609913e5a0a67448364015d34b8a6ab9 /src | |
parent | d9b5cb238d7e1f7ec998ffd002e15cf9c1a48425 (diff) | |
download | pacman-9f1c5f0251c202ad504f03464da23a5050914157.tar.gz pacman-9f1c5f0251c202ad504f03464da23a5050914157.tar.xz |
pacsort: test string is not NULL before strlen
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-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; } |