19 Sep
2024
19 Sep
'24
7:07 a.m.
Rémi Bernon (@rbernon) commented about tools/winebuild/import.c:
ret = p = xmalloc( len * 4 + 1 ); for ( ; len > 0; len--, name++) { - if (!strchr( valid_chars, *name )) p += sprintf( p, "$x%02x", *name ); + if (!strchr( valid_chars, *name )) + p += snprintf( p, (len * 4 + 1) - (p - ret), "$x%02x", *name );
This one look a bit awful, what about keeping an end pointer, initialized right after the alloc instead? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6524#note_82607