From 595fc925e3a809cd48b3c7d1a9185db87450733a Mon Sep 17 00:00:00 2001 From: Vincent Stumpf Date: Fri, 15 Jul 2022 20:08:02 -0700 Subject: [PATCH] Fix an invalid access (#7102) --- src/map/npc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map/npc.cpp b/src/map/npc.cpp index f808f94d4d..7b01b790cb 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -4956,7 +4956,7 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c for( i = 0; i < ( strlen( message ) + 1 ) && k < 127; i ++ ) { if( message[i] == ' ' || message[i] == '\0' ) { - if( message[ ( i - 1 ) ] == ' ' ) { + if (i > 0 && message[i - 1] == ' ') { continue; // To prevent "@atcmd [space][space]" and .@atcmd_numparameters return 1 without any parameter. } temp[k] = '\0';