From b1d22b02963b16c4edcce0cd5d2bc521d97348f9 Mon Sep 17 00:00:00 2001 From: skotlex Date: Sun, 1 Apr 2007 21:15:17 +0000 Subject: - Reviewed atcommand.c and charcommand.c to make sure there's no scanf where a string argument is specified without a size limit. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10111 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/charcommand.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/map/charcommand.c') diff --git a/src/map/charcommand.c b/src/map/charcommand.c index f241148c3..e826d42b8 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -224,7 +224,7 @@ CharCommandType charcommand(struct map_session_data* sd, const int level, const int i = 0; memset(info, 0, sizeof(CharCommandInfo)); sscanf(p, "%100s", command); - command[sizeof(command)-1] = '\0'; + command[100] = '\0'; while (charcommand_info[i].type != CharCommand_Unknown) { if (strcmpi(command+1, charcommand_info[i].command+1) == 0 && level >= charcommand_info[i].level) { @@ -891,16 +891,16 @@ charcommand_effect(const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd = NULL; - char target[255]; + char target[NAME_LENGTH]; int type = 0; nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%d %s", &type, target) != 2) { + if (!message || !*message || sscanf(message, "%d %23s", &type, target) != 2) { clif_displaymessage(fd, "usage: #effect ."); return -1; } - if((pl_sd=map_nick2sd((char *) target)) == NULL) + if((pl_sd=map_nick2sd(target)) == NULL) return -1; clif_specialeffect(&pl_sd->bl, type, AREA); -- cgit v1.2.3-60-g2f50