Skip to content

Commit fb5fc62

Browse files
authored
Check for VSB errors earlier in function (#18)
1 parent 05a6705 commit fb5fc62

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/vmod_querymodifier.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ static char *rebuild_query_string(VRT_CTX, const char *uri_base,
170170
}
171171

172172
VSB_cat(vsb, uri_base);
173+
if (VSB_error(vsb)) {
174+
VRT_fail(ctx, "VSB overflow while appending base URI");
175+
VSB_destroy(&vsb);
176+
return NULL;
177+
}
173178

174179
for (size_t i = 0; i < param_count; i++) {
175180
query_param_t *current = &params[i];
@@ -181,6 +186,13 @@ static char *rebuild_query_string(VRT_CTX, const char *uri_base,
181186
// Parameter with no value
182187
VSB_printf(vsb, "%c%s", sep, current->name);
183188
}
189+
190+
if (VSB_error(vsb)) {
191+
VRT_fail(ctx, "VSB overflow while building query string");
192+
VSB_destroy(&vsb);
193+
return NULL;
194+
}
195+
184196
sep = '&';
185197
}
186198
}

0 commit comments

Comments
 (0)