Skip to content

Commit c4ac6c5

Browse files
fix off by one (#3506)
1 parent 0c35caf commit c4ac6c5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

appsec/src/extension/request_abort.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,10 @@ zend_array *nonnull dd_request_abort_static_page_spec(
515515
}
516516

517517
{
518-
char buf[sizeof("18446744073709551615") - 1];
519-
size_t len = sprintf(buf, "%zu", body_len);
518+
// This magic number is the string representation of SIZE_MAX on 64 bit
519+
// systems
520+
char buf[sizeof("18446744073709551615")];
521+
size_t len = snprintf(buf, sizeof(buf), "%zu", body_len);
520522
zend_string *s = zend_string_init(buf, len, 0);
521523
zval cont_len_zv;
522524
ZVAL_STR(&cont_len_zv, s);

0 commit comments

Comments
 (0)