@cryptotaxi247 / netdata-1 / commits / 6fcab949e

strip control characters from URLs before logged

Costa Tsaousis (ktsaou) committed Apr 17, 2018 at 22:55 UTC 6fcab949e14799535532f2c55cb4698816faf5f7
1 file changed +13 -1
src/web_client.c
+13 -1
@@ -53,6 +53,18 @@ static inline int web_client_uncrock_socket(struct web_client *w) {
53 return 0;
54 }
55
56 +static inline char *strip_control_characters(char *url) {
57 + char *s = url;
58 + if(!s) return "";
59 +
60 + if(iscntrl(*s)) *s = ' ';
61 + while(*++s) {
62 + if(iscntrl(*s)) *s = ' ';
63 + }
64 +
65 + return url;
66 +}
67 +
68 void web_client_request_done(struct web_client *w) {
69 web_client_uncrock_socket(w);
70
@@ -120,7 +132,7 @@ void web_client_request_done(struct web_client *w) {
132 , dt_usec(&tv, &w->tv_ready) / 1000.0
133 , dt_usec(&tv, &w->tv_in) / 1000.0
134 , w->response.code
123 - , w->last_url
135 + , strip_control_characters(w->last_url)
136 );
137 }
138