Need to properly zero-ize buffers before passing them to apache
authorwarlord <warlord@cb58f699-b61c-0410-a6fe-9272a202ed29>
Wed, 17 Mar 2004 21:06:33 +0000 (21:06 +0000)
committerwarlord <warlord@cb58f699-b61c-0410-a6fe-9272a202ed29>
Wed, 17 Mar 2004 21:06:33 +0000 (21:06 +0000)
to get filled in, otherwise we sometimes get garbage back from
apache.

git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@839 cb58f699-b61c-0410-a6fe-9272a202ed29

apache-2.0/cgiparse.cpp
apache-2.0/mod_shib.cpp

index 9be3daa..2086d92 100644 (file)
@@ -94,7 +94,9 @@ char *makeword(char *line, char stop)
         ++x;
     y=0;
 
-    while(line[y++] = line[x++]);
+    while(line[x])
+      line[y++] = line[x++];
+    line[y] = '\0';
     return word;
 }
 
index d93fc47..efa95c6 100644 (file)
@@ -614,8 +614,11 @@ extern "C" int shib_shire_handler (request_rec* r)
     char buff[BUFSIZ];
     //ap_hard_timeout("[mod_shib] CGI Parser", r);
 
-    while (ap_get_client_block(r, buff, sizeof(buff)) > 0)
+    memset(buff, 0, sizeof(buff));
+    while (ap_get_client_block(r, buff, sizeof(buff)) > 0) {
       cgistr += buff;
+      memset(buff, 0, sizeof(buff));
+    }
 
     //ap_kill_timeout(r);