From 638e2b5c985c13a8138d1cb166d5fdb8148b690c Mon Sep 17 00:00:00 2001 From: shennetsind Date: Thu, 31 Jan 2013 16:11:07 -0200 Subject: Fixed Bug #3080 Replaced strncpy with safestrncpy where I found would be beneficial. http://hercules.ws/board/tracker/issue-3080-safestrncpy-instead-of-strncpy-where-applicable/ Also modifying headers accordingly. Signed-off-by: shennetsind --- src/common/mapindex.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/common/mapindex.c') diff --git a/src/common/mapindex.c b/src/common/mapindex.c index d46047833..cea945ac0 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -1,5 +1,6 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules dev team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena dev team #include "../common/mmo.h" #include "../common/showmsg.h" @@ -37,7 +38,7 @@ const char* mapindex_getmapname(const char* string, char* output) len -= 4; // strip .gat extension len = min(len, MAP_NAME_LENGTH-1); - strncpy(dest, string, len+1); + safestrncpy(dest, string, len+1); memset(&dest[len], '\0', MAP_NAME_LENGTH-len); return dest; @@ -61,7 +62,7 @@ const char* mapindex_getmapname_ext(const char* string, char* output) ShowWarning("(mapindex_normalize_name) Map name '%*s' is too long!\n", 2*MAP_NAME_LENGTH, buf); len--; } - strncpy(dest, buf, len+1); + safestrncpy(dest, buf, len+1); if (len < 4 || stricmp(&dest[len-4], ".gat") != 0) { strcpy(&dest[len], ".gat"); -- cgit v1.2.3-70-g09d2