Skip to content

Commit

Permalink
winebuild: Replace sprintf with snprintf to avoid deprecation warning…
Browse files Browse the repository at this point in the history
…s on macOS.
  • Loading branch information
mrpippy authored and julliard committed Sep 19, 2024
1 parent 070e393 commit 1d8ef42
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/winebuild/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,18 @@ static const char valid_chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS
/* encode a dll name into a linker-compatible name */
static char *encode_dll_name( const char *name )
{
char *p, *ret;
char *p, *ret, *ret_end;
int len = strlen(name);

if (strendswith( name, ".dll" )) len -= 4;
if (strspn( name, valid_chars ) >= len) return strmake( "%.*s", len, name );

ret = p = xmalloc( len * 4 + 1 );
ret_end = ret + (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, ret_end - p, "$x%02x", *name );
else *p++ = *name;
}
*p = 0;
Expand Down

0 comments on commit 1d8ef42

Please sign in to comment.