Skip to content

Commit dc8afb4

Browse files
fzipiclaude
andcommitted
fix: bound the %u escape write with snprintf
Sonar flagged the sprintf call added by the previous commit. The output buffer is sized for the worst case, so this only makes the bound explicit. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mhspv9mxtMSiWC1U8mVH1H
1 parent 153070b commit dc8afb4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎apache2/msc_util.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ char *utf8_unicode_inplace_ex(apr_pool_t *mp, unsigned char *input, long int inp
191191
if (unicode_len > 0) {
192192
i += unicode_len;
193193
/* code points above U+FFFF need five hex digits */
194-
data += sprintf(data, "%%u%04x", d);
194+
data += snprintf(data, len - (data - rval), "%%u%04x", d);
195195
*changed = 1;
196196
}
197197
else {

0 commit comments

Comments
 (0)