]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_sorcery_memory_cache: Fix SEGV in some CLI commands 10/2310/1
authorGeorge Joseph <george.joseph@fairview5.com>
Thu, 25 Feb 2016 20:17:04 +0000 (13:17 -0700)
committerGeorge Joseph <george.joseph@fairview5.com>
Thu, 25 Feb 2016 20:17:04 +0000 (13:17 -0700)
A few of the CLI commands weren't checking for enough arguments
and were SEGVing.

Change-Id: Ie6494132ad2fe54b4f014bcdc112a37c36a9b413

res/res_sorcery_memory_cache.c

index 99db0ce9c2801eb13d941b2c66cf9dfe0059cab4..f2ed5d5c80bca5a93cdc2e51ff639e85dd0d042f 100644 (file)
@@ -1830,7 +1830,7 @@ static char *sorcery_memory_cache_expire(struct ast_cli_entry *e, int cmd, struc
                }
        }
 
-       if (a->argc > 6) {
+       if (a->argc < 5 || a->argc > 6) {
                return CLI_SHOWUSAGE;
        }
 
@@ -1884,7 +1884,7 @@ static char *sorcery_memory_cache_stale(struct ast_cli_entry *e, int cmd, struct
                }
        }
 
-       if (a->argc > 6) {
+       if (a->argc < 5 || a->argc > 6) {
                return CLI_SHOWUSAGE;
        }
 
@@ -1943,7 +1943,7 @@ static char *sorcery_memory_cache_populate(struct ast_cli_entry *e, int cmd, str
                }
        }
 
-       if (a->argc > 5) {
+       if (a->argc != 5) {
                return CLI_SHOWUSAGE;
        }