From 4ba4f5a9bc5d89f5ccc6eead79994a3971ebabbf Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 15 Nov 2022 15:46:31 +0300 Subject: [PATCH 1/2] wscript: keep lib prefix only on selected platforms, e.g. Android --- wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wscript b/wscript index 46017809..c4f85fae 100644 --- a/wscript +++ b/wscript @@ -175,7 +175,7 @@ def configure(conf): conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions']) # strip lib from pattern - if conf.env.DEST_OS in ['linux', 'darwin']: + if conf.env.DEST_OS not in ['android']: if conf.env.cshlib_PATTERN.startswith('lib'): conf.env.cshlib_PATTERN = conf.env.cshlib_PATTERN[3:] if conf.env.cxxshlib_PATTERN.startswith('lib'): From 813aa0ae91296075f539b773ac77963829e5fcc8 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Wed, 16 Nov 2022 05:45:28 +0500 Subject: [PATCH 2/2] More safe string copying. --- dlls/client.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index cd33bd20..53786de7 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -355,13 +355,15 @@ void Host_Say( edict_t *pEntity, int teamonly ) { if( CMD_ARGC() >= 2 ) { - sprintf( szTemp, "%s %s", (char *)pcmd, (char *)CMD_ARGS() ); + _snprintf( szTemp, sizeof(szTemp) - 1, "%s %s", (char *)pcmd, (char *)CMD_ARGS() ); } else { // Just a one word command, use the first word...sigh - sprintf( szTemp, "%s", (char *)pcmd ); + strncpy( szTemp, (char *)pcmd, sizeof(szTemp) - 1 ); } + szTemp[sizeof(szTemp) - 1] = '\0'; + p = szTemp; } @@ -377,11 +379,12 @@ void Host_Say( edict_t *pEntity, int teamonly ) // turn on color set 2 (color on, no sound) if( player->IsObserver() && ( teamonly ) ) - sprintf( text, "%c(SPEC) %s: ", 2, STRING( pEntity->v.netname ) ); + _snprintf( text, sizeof(text) - 1, "%c(SPEC) %s: ", 2, STRING( pEntity->v.netname ) ); else if( teamonly ) - sprintf( text, "%c(TEAM) %s: ", 2, STRING( pEntity->v.netname ) ); + _snprintf( text, sizeof(text) - 1, "%c(TEAM) %s: ", 2, STRING( pEntity->v.netname ) ); else - sprintf( text, "%c%s: ", 2, STRING( pEntity->v.netname ) ); + _snprintf( text, sizeof(text) - 1, "%c%s: ", 2, STRING( pEntity->v.netname ) ); + text[sizeof(text) - 1] = '\0'; j = sizeof( text ) - 2 - strlen( text ); // -2 for /n and null terminator if( (int)strlen( p ) > j )