Browse Source

use buffer_string_set_length() to truncate strings

personal/stbuehler/mod-csrf-old
Glenn Strauss 6 years ago
parent
commit
df8032a7c8
  1. 2
      src/configparser.y
  2. 2
      src/request.c

2
src/configparser.y

@ -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);

2
src/request.c

@ -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("]"));

Loading…
Cancel
Save