]> granicus.if.org Git - apache/commitdiff
Add defaults and comments for better robustness against misuse
authorNick Kew <niq@apache.org>
Wed, 16 Nov 2005 21:20:33 +0000 (21:20 +0000)
committerNick Kew <niq@apache.org>
Wed, 16 Nov 2005 21:20:33 +0000 (21:20 +0000)
(based on comments from Chris Darroch).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@345128 13f79535-47bb-0310-9956-ffa450edef68

modules/database/mod_dbd.c
modules/database/mod_dbd.h

index 1144fba53bb1142a3a1a1c846b19781d551c7879..7a7aa2ffdb1c82c4313174120efba670327ad1fd 100644 (file)
@@ -185,6 +185,7 @@ static void *dbd_cfg(apr_pool_t *p, server_rec *x)
 {
     svr_cfg *svr = (svr_cfg*) apr_pcalloc(p, sizeof(svr_cfg));
     svr->persist = -1;
+    svr->name = svr->params = ""; /* don't risk segfault on misconfiguration */
 #if APR_HAS_THREADS
     svr->nmin = DEFAULT_NMIN;
     svr->nkeep = DEFAULT_NKEEP;
index f98df9948e19ab66f213141390e6111124a34629..83f2535d1c88041d6aa743f869d5a4a66dcec8d7 100644 (file)
@@ -64,7 +64,10 @@ AP_DECLARE(ap_dbd_t*) ap_dbd_acquire(request_rec*);
  */
 AP_DECLARE(ap_dbd_t*) ap_dbd_cacquire(conn_rec*);
 
-/* Prepare a statement for use by a client module */
+/* Prepare a statement for use by a client module during
+ * the server startup/configuration phase.  Can't be called
+ * after the server has created its children (use apr_dbd_*).
+ */
 AP_DECLARE(void) ap_dbd_prepare(server_rec*, const char*, const char*);
 
 /* Also export them as optional functions for modules that prefer it */