projects
/
freeradius.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
6fd5c52
)
Merge pull request #1246 from mcnewton/v3.0.x
author
Alan DeKok
<aland@freeradius.org>
Fri, 18 Sep 2015 11:37:59 +0000
(07:37 -0400)
committer
Alan DeKok
<aland@freeradius.org>
Fri, 18 Sep 2015 11:37:59 +0000
(07:37 -0400)
don't segfault when asked for help
src/main/command.c
patch
|
blob
|
history
diff --git
a/src/main/command.c
b/src/main/command.c
index
99fa117
..
099bb78
100644
(file)
--- a/
src/main/command.c
+++ b/
src/main/command.c
@@
-2851,10
+2851,19
@@
static void print_help(rad_listen_t *listener, int argc, char *argv[],
{
int i;
+ /* this should never happen, but if it does then just return gracefully */
+ if (!table) return;
+
for (i = 0; table[i].command != NULL; i++) {
if (argc > 0) {
if (strcmp(table[i].command, argv[0]) == 0) {
- print_help(listener, argc - 1, argv + 1, table[i].table, recursive);
+ if (table[i].table) {
+ print_help(listener, argc - 1, argv + 1, table[i].table, recursive);
+ } else {
+ if (table[i].help) {
+ cprintf(listener, "%s\n", table[i].help);
+ }
+ }
return;
}