From d2fef71366b200297363b2b4ba8afb115f9dcda2 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Mon, 18 Nov 2002 14:13:53 +0000 Subject: [PATCH] use memcpy() instead of strncpy() since strncpy() is more expensive but 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/mappers/mod_negotiation.c b/modules/mappers/mod_negotiation.c index 93392a0e4f..28e7aa5598 100644 --- a/modules/mappers/mod_negotiation.c +++ b/modules/mappers/mod_negotiation.c @@ -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; -- 2.40.0