@cryptotaxi247 / netdata-1 / commits / b659db4bc

dont exceed buffer boundaries, when the buffer is empty (#16664)

Costa Tsaousis committed Dec 24, 2023 at 13:17 UTC b659db4bc155ef63f9b23b5521dfb796c6c1d2ba
2 files changed +3 -7
web/server/web_client.c
+3 -6
@@ -79,14 +79,11 @@ static inline int web_client_uncork_socket(struct web_client *w __maybe_unused)
79 return 0;
80 }
81
82 -char *strip_control_characters(char *url) {
83 - char *s = url;
84 - if(!s) return "";
82 +static inline char *strip_control_characters(char *url) {
83 + if(!url) return "";
84
86 - if(iscntrl(*s)) *s = ' ';
87 - while(*++s) {
85 + for(char *s = url; *s ;s++)
86 if(iscntrl(*s)) *s = ' ';
89 - }
87
88 return url;
89 }
web/server/web_client.h
-1
@@ -208,7 +208,6 @@ void web_client_request_done(struct web_client *w);
208 void buffer_data_options2string(BUFFER *wb, uint32_t options);
209
210 void web_client_build_http_header(struct web_client *w);
211 -char *strip_control_characters(char *url);
211
212 void web_client_reuse_from_cache(struct web_client *w);
213 struct web_client *web_client_create(size_t *statistics_memory_accounting);