You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "maskit (via GitHub)" <gi...@apache.org> on 2023/02/04 00:12:26 UTC
[GitHub] [trafficserver] maskit opened a new pull request, #9382: Use snprintf
maskit opened a new pull request, #9382:
URL: https://github.com/apache/trafficserver/pull/9382
Another cleanup for deprecated sprintf. This makes `make` and `make check` happy with my configuration (there are still some sprintf left).
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] maskit commented on a diff in pull request #9382: Use snprintf
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on code in PR #9382:
URL: https://github.com/apache/trafficserver/pull/9382#discussion_r1098112779
##########
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:
You're right. I updated the code.
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] maskit merged pull request #9382: Use snprintf
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit merged PR #9382:
URL: https://github.com/apache/trafficserver/pull/9382
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] bneradt commented on a diff in pull request #9382: Use snprintf
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org