]> granicus.if.org Git - apache/commitdiff
use memcpy() instead of strncpy() since strncpy() is more expensive but
authorJeff Trawick <trawick@apache.org>
Mon, 18 Nov 2002 14:13:53 +0000 (14:13 +0000)
committerJeff Trawick <trawick@apache.org>
Mon, 18 Nov 2002 14:13:53 +0000 (14:13 +0000)
none of its extra function is needed

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

modules/mappers/mod_negotiation.c

index 93392a0e4f9fbc1a879b415e9cb58aab1bf31945..28e7aa5598e037da2a34bcf16cbb1df64615ab92 100644 (file)
@@ -809,7 +809,11 @@ static apr_off_t get_body(char *buffer, apr_size_t *len, const char *tag,
         return -1;
     }
 
-    strncpy(buffer + *len, tag, taglen);
+    /* put a copy of the tag *after* the data read from the file
+     * so that strstr() will find something with no reliance on
+     * terminating '\0'
+     */
+    memcpy(buffer + *len, tag, taglen);
     endbody = strstr(buffer, tag);
     if (endbody == buffer + *len) {
         return -1;