From 39a8fa2eb610c11251787149e8a415971e43be42 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 21 Dec 2006 15:44:39 +0000 Subject: [PATCH] - Changed a certain snprintf to strncpy, you really really really REALLY shouldn't use snprintf with a format argument that may contain unpredictable string sequences! git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9550 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ src/map/script.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 1aa09400be..2ad9e9ae04 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/12/21 + * Changed a certain snprintf to strncpy, which should fix the problems with + parsing switches in the script engine. * Added back cropping the attack delay to attack motion for those weird mobs that have a aDelay less than their aMotion time. [Skotlex] * Added a 1-node cache to db. Removed party_cache and guild_cache since diff --git a/src/map/script.c b/src/map/script.c index e8aea1fd7a..a493322cc9 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1025,7 +1025,7 @@ const char* parse_syntax(const char* p) { if(*p != ':') disp_error_message("parse_syntax: expect ':'",p); memcpy(label,"if(",3); - snprintf(label+3,len,p2); + strncpy(label+3,p2,len); sprintf(label+3+len," != $@__SW%x_VAL) goto __SW%x_%x;", syntax.curly[pos].index,syntax.curly[pos].index,syntax.curly[pos].count+1); syntax.curly[syntax.curly_count++].type = TYPE_NULL;