PATCH for help-browser




Fri Jun 12 12:28:17 1998  Robert Wilhelm  <robert@physiol.med.tu-muenchen.de>

        * transport.c (transportHTTP): 
        add CRs as required by HTTP spec.
        add "Host:" to work better with virtual httpd.
        check for buffer overflow.


--- transport.c.org     Fri Jun 12 12:21:44 1998
+++ transport.c Fri Jun 12 12:32:53 1998
@@ -166,7 +166,11 @@
        return -1;
     }
 
-    sprintf(buf, "GET %s HTTP/1.0\n\n", docObjGetDecomposedUrl(obj)->path);
+    if ( sizeof(buf) == snprintf(buf, sizeof(buf), "GET %s HTTP/1.0\r\nHost: %s\r\n\r\n", docObjGetDecomposedUrl(obj)->path,docObjGetDecomposedUrl(obj)->host)) {
+       g_warning("buffer too small");
+       return -1;
+    }
+
     write(sock, buf, strlen(buf));
 
     /* This is not efficient */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]