bneradt commented on code in PR #9382:
URL: https://github.com/apache/trafficserver/pull/9382#discussion_r1098044774


##########
iocore/cache/test/main.cc:
##########
@@ -116,11 +116,11 @@ build_hdrs(HTTPInfo &info, const char *url, const char 
*content_type)
 
   REQUIRE(url != nullptr);
 
-  p += sprintf(p, "GET %s HTTP/1.1\n", url);
-  p += sprintf(p, "User-Agent: curl/7.47.0\n");
-  p += sprintf(p, "Accept: %s\n", content_type);
-  p += sprintf(p, "Vary: Content-type\n");
-  p += sprintf(p, "Proxy-Connection: Keep-Alive\n\n");
+  p += snprintf(p, sizeof(buf), "GET %s HTTP/1.1\n", url);
+  p += snprintf(p, sizeof(buf), "User-Agent: curl/7.47.0\n");

Review Comment:
   Actually, I suppose we need to decrement the size of the buffer passed to 
snprintf with each write. Maybe something like:
   
   ```
     p += snprintf(p, sizeof(buf) - strnlen(p, sizeof(buf)), "User-Agent: 
curl/7.47.0\n");
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to