bugfix a SIGSEGV during 'show debug condition' in radmin
authorJorge Pereira <jpereiran@gmail.com>
Fri, 29 May 2015 18:54:51 +0000 (15:54 -0300)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 29 May 2015 19:04:26 +0000 (15:04 -0400)
src/main/parser.c

index 009989e..b41c894 100644 (file)
@@ -54,7 +54,14 @@ size_t fr_cond_sprint(char *buffer, size_t bufsize, fr_cond_t const *in)
        char *end = buffer + bufsize - 1;
        fr_cond_t const *c = in;
 
+       rad_assert(buffsize > 0);
+
 next:
+       if (!c) {
+               buffer[0] = '\0';
+               return 0;
+       }
+
        if (c->negate) {
                *(p++) = '!';   /* FIXME: only allow for child? */
        }