Skip to content

Commit

Permalink
Ignore zero length arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Oct 8, 2016
1 parent a2b0aaa commit 5e261f2
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions src/modules/rlm_redis_ippool/rlm_redis_ippool_tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1478,22 +1478,35 @@ do { \
/*
* Unescape sequences in the pool name
*/
if (argv[1]) {
uint8_t *arg;
size_t len;
if (argv[1] && (argv[1][0] != '\0')) {
uint8_t *arg;
size_t len;

arg = talloc_array(conf, uint8_t, strlen(argv[1]));
len = fr_value_str_unescape(arg, argv[1], talloc_array_length(arg), '"');
MEM(pool_arg = talloc_realloc(conf, arg, uint8_t, len));
/*
* Be forgiving about zero length strings...
*/
len = strlen(argv[1]);
MEM(arg = talloc_array(conf, uint8_t, len));
len = fr_value_str_unescape(arg, argv[1], len, '"');
if (!fr_cond_assert(len)) {
MEM(pool_arg = talloc_realloc(conf, arg, uint8_t, len));
} else {
TALLOC_FREE(arg);
}
}

if (argc >= 3) {
uint8_t *arg;
size_t len;
if (argc >= 3 && (argv[2][0] != '\0')) {
uint8_t *arg;
size_t len;

arg = talloc_array(conf, uint8_t, strlen(argv[2]));
len = fr_value_str_unescape(arg, argv[2], talloc_array_length(arg), '"');
MEM(range_arg = talloc_realloc(conf, arg, uint8_t, len));
len = strlen(argv[2]);
MEM(arg = talloc_array(conf, uint8_t, len));
len = fr_value_str_unescape(arg, argv[2], len, '"');
if (!fr_cond_assert(len)) {
MEM(range_arg = talloc_realloc(conf, arg, uint8_t, len));
} else {
TALLOC_FREE(arg);
}
}

if (!do_import && !do_export && !list_pools && !print_stats && (p == ops)) {
Expand Down

0 comments on commit 5e261f2

Please sign in to comment.