summaryrefslogtreecommitdiff
path: root/src/char/mapif.c
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-05-01 08:41:11 +0200
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-05-09 22:01:53 +0200
commit08922748cfc4cd30cbe5d2e6bdee9f2f7c4c7c39 (patch)
tree4fdee381714b738cc6af000f59e84c3a2399866f /src/char/mapif.c
parent66de70164a1cd0fed59671e09bad7c2fca1d90eb (diff)
downloadhercules-08922748cfc4cd30cbe5d2e6bdee9f2f7c4c7c39.tar.gz
hercules-08922748cfc4cd30cbe5d2e6bdee9f2f7c4c7c39.tar.bz2
hercules-08922748cfc4cd30cbe5d2e6bdee9f2f7c4c7c39.tar.xz
hercules-08922748cfc4cd30cbe5d2e6bdee9f2f7c4c7c39.zip
Adjust size of fields holding a string variable's value to SCRIPT_STRING_VAR_LENGTH + 1
Also exclude NULL-terminator from string variable value length in inter-server communication.
Diffstat (limited to 'src/char/mapif.c')
-rw-r--r--src/char/mapif.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/char/mapif.c b/src/char/mapif.c
index 9077afae4..f0c886586 100644
--- a/src/char/mapif.c
+++ b/src/char/mapif.c
@@ -2030,7 +2030,8 @@ static int mapif_parse_Registry(int fd)
if (count != 0) {
int cursor = 14, i;
- char key[SCRIPT_VARNAME_LENGTH+1], sval[254];
+ char key[SCRIPT_VARNAME_LENGTH + 1];
+ char sval[SCRIPT_STRING_VAR_LENGTH + 1];
bool isLoginActive = sockt->session_is_active(chr->login_fd);
if (isLoginActive)
@@ -2057,8 +2058,8 @@ static int mapif_parse_Registry(int fd)
/* str */
case 2:
len = RFIFOB(fd, cursor);
- safestrncpy(sval, RFIFOP(fd, cursor + 1), min((int)sizeof(sval), len));
- cursor += len + 1;
+ safestrncpy(sval, RFIFOP(fd, cursor + 1), min((int)sizeof(sval), len + 1));
+ cursor += len + 2;
inter->savereg(account_id, char_id, key, index, (intptr_t)sval, true);
break;
case 3: