use buffer_string_set_length() to truncate strings

personal/stbuehler/mod-csrf-old
Glenn Strauss 2016-05-23 14:12:24 -04:00
parent c463860451
commit df8032a7c8
2 changed files with 2 additions and 2 deletions

View File

@ -495,7 +495,7 @@ context ::= DOLLAR SRVVARNAME(B) LBRACKET stringop(C) RBRACKET cond(E) expressio
}
else {
int rc;
buffer_commit(rvalue, (size_t)(slash - rvalue->ptr)); /*(truncate)*/
buffer_string_set_length(rvalue, (size_t)(slash - rvalue->ptr)); /*(truncate)*/
rc = http_request_host_normalize(rvalue);
buffer_append_string_len(rvalue, CONST_STR_LEN("/"));
buffer_append_int(rvalue, (int)nm_bits);

View File

@ -302,7 +302,7 @@ int http_request_host_normalize(buffer *b) {
if (1 != rc) return -1;
inet_ntop(AF_INET6,(const void *)&addr, buf, sizeof(buf));
buffer_commit(b, 1); /* truncate after '[' */
buffer_string_set_length(b, 1); /* truncate after '[' */
buffer_append_string(b, buf);
buffer_append_string_len(b, CONST_STR_LEN("]"));