JosiahWI commented on code in PR #13303:
URL: https://github.com/apache/trafficserver/pull/13303#discussion_r3444834509


##########
plugins/header_rewrite/operators.cc:
##########
@@ -100,10 +100,11 @@ createRequestString(const std::string_view &value, char 
(&req_buf)[MAX_SIZE], in
 
   if (TSUrlCreate(url_buf, &url_loc) == TS_SUCCESS && TSUrlParse(url_buf, 
url_loc, &start, end) == TS_PARSE_DONE) {
     const char *host = TSUrlHostGet(url_buf, url_loc, &host_len);
-    const char *url  = TSUrlStringGet(url_buf, url_loc, &url_len);
+    char       *url  = TSUrlStringGet(url_buf, url_loc, &url_len);
 
     *req_buf_size = snprintf(req_buf, MAX_SIZE, "GET %.*s HTTP/1.1\r\nHost: 
%.*s\r\n\r\n", url_len, url, host_len, host);

Review Comment:
   @moonchen Do you have a reference for `snprintf` guaranteeing not to 
dereference the string pointer when the precision is 0? [The cppreference page 
for `snprintf`](https://en.cppreference.com/cpp/io/c/fprintf) states, "The 
argument must be a pointer to the initial element of an array of characters." 
Is there an exception for the 0 precision edge case specified somewhere, or are 
we relying on compiler implementers having what we think is common sense? 



-- 
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