]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Fix segfault in update_db_entry()
authorMartin.Lottermoser@t-online.de <Martin.Lottermoser@t-online.de>
Sun, 9 Jun 2013 12:04:25 +0000 (22:04 +1000)
committerPaul Mackerras <paulus@samba.org>
Sun, 9 Jun 2013 12:04:25 +0000 (22:04 +1000)
The function update_db_entry() may only be called if pppdb is not NULL;
unfortunately in one situation it is.  Other calls to update_db_entry()
are protected against this, see, e.g., the end of script_setenv().

This is from the Debian pppd patches, and fixes Debian bug 308136
(SEGV in pppd).

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd/main.c

index 6e7378be8d7e21ec0d7ed23e17630ec27b6d5e22..6d50d1bac1d998e7ad359a1ec4e35852e3739e1d 100644 (file)
@@ -2043,9 +2043,11 @@ script_setenv(var, value, iskey)
                free(p-1);
                script_env[i] = newstring;
 #ifdef USE_TDB
                free(p-1);
                script_env[i] = newstring;
 #ifdef USE_TDB
-               if (iskey && pppdb != NULL)
-                   add_db_key(newstring);
-               update_db_entry();
+               if (pppdb != NULL) {
+                   if (iskey)
+                       add_db_key(newstring);
+                   update_db_entry();
+               }
 #endif
                return;
            }
 #endif
                return;
            }