mod_commands: Fix a segfault if no arguments is provided to limit_hash_usage

This commit is contained in:
Marc Olivier Chouinard 2010-07-14 14:29:24 -04:00 committed by Marc Olivier Chouinard
parent 634ca37067
commit 8ceb2a9b27
1 changed files with 8 additions and 3 deletions

View File

@ -4279,12 +4279,17 @@ end:
return SWITCH_STATUS_SUCCESS;
}
#define LIMIT_HASH_USAGE_USAGE "<backend> <realm> <id> [rate]"
#define LIMIT_HASH_USAGE_USAGE "<realm> <id> [rate] (Using deprecated limit api, check limit_usage with backend param)"
SWITCH_STANDARD_API(limit_hash_usage_function)
{
char *mydata = NULL;
mydata = switch_core_session_sprintf(session, "hash %s", cmd);
return limit_usage_function(mydata, session, stream);
if (!zstr(cmd)) {
mydata = switch_core_session_sprintf(session, "hash %s", cmd);
return limit_usage_function(mydata, session, stream);
} else {
stream->write_function(stream, "USAGE: limit_hash_usage %s\n", LIMIT_HASH_USAGE_USAGE);
return SWITCH_STATUS_SUCCESS;
}
}
#define LIMIT_STATUS_USAGE "<backend>"