]> git.sur5r.net Git - openldap/commitdiff
init output_string to NULL, and check in printbase() to make sure we don't pass garbage
authorBen Collins <bcollins@openldap.org>
Wed, 13 Sep 2000 21:44:37 +0000 (21:44 +0000)
committerBen Collins <bcollins@openldap.org>
Wed, 13 Sep 2000 21:44:37 +0000 (21:44 +0000)
clients/ud/main.c
clients/ud/util.c

index aebf89c4dc83e8919d70e27f696cdd5fbe48b4be..4e2dac8adbbefb58fa8741e24e6b335256bb8333 100644 (file)
@@ -331,7 +331,7 @@ change_base( int type, char **base, char *s )
 {
        register char *cp;                      /* utility pointers */
        char **rdns;                            /* for parsing */
-       char *output_string;                    /* for nice output */
+       char *output_string = NULL;             /* for nice output */
        int num_picked;                         /* # of selected base */
        int j;                                  /* used with num_picked */
        int i = 1;                              /* index into choices array */
index 16253263a49f0f76b044808894363f169fe5e497..6505f52eccbefbab049ed94cb462b20518589690 100644 (file)
@@ -44,6 +44,10 @@ printbase( char *lead, char *s )
        if (debug & D_TRACE)
                printf("->printbase(%s, %s)\n", lead, s);
 #endif
+       if (lead == NULL) {
+               printf("root");
+               return;
+       }
        if (s == NULL) {
                printf("%sroot\n", lead);
                return;