Skip to content

Commit 74bd6c7

Browse files
committed
vsgi: Check if SCGI netstring is too big
1 parent 7e28d8c commit 74bd6c7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/vsgi/servers/vsgi-scgi.vala

+5-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ namespace VSGI.SCGI {
196196
environment = Environ.set_variable (environment, key, @value);
197197
}
198198

199-
assert (read == size);
199+
if (read > size) {
200+
throw new Error.MALFORMED_NETSTRING ("The netstring is bigger than declared: expected '%" + size_t.FORMAT + "B' but consumed '" + size_t.FORMAT + "B'.",
201+
size,
202+
read);
203+
}
200204

201205
// consume the comma following a chunk
202206
if (reader.read_byte () != ',') {

0 commit comments

Comments
 (0)