diff options
author | Jedzkie <jedzkie13@rocketmail.com> | 2020-06-23 08:00:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 08:00:00 +0800 |
commit | 520863eaeda83da14b88d09f6378cd8abd5a5174 (patch) | |
tree | 2496ea36744dc2f51d264741a78699e719ceeb3b /src/map/intif.c | |
parent | 0b7768837bed2aa521de5b9b76b2348943d7db20 (diff) | |
parent | 9b89425550094f51d633e5b5d6e86af65bffbf39 (diff) | |
download | hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.tar.gz hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.tar.bz2 hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.tar.xz hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.zip |
Merge branch 'master' into jedzkie-pr03
Diffstat (limited to 'src/map/intif.c')
-rw-r--r-- | src/map/intif.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/map/intif.c b/src/map/intif.c index a420b7204..276b40780 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -218,13 +218,13 @@ static int intif_saveregistry(struct map_session_data *sd) plen += 1; if( p->value ) { - len = strlen(p->value)+1; + len = strlen(p->value); - WFIFOB(inter_fd, plen) = (unsigned char)len;/* won't be higher; the column size is 254 */ + WFIFOB(inter_fd, plen) = (unsigned char)len; // Won't be higher; the column size is 255. plen += 1; - safestrncpy(WFIFOP(inter_fd,plen), p->value, len); - plen += len; + safestrncpy(WFIFOP(inter_fd, plen), p->value, len + 1); + plen += len + 1; } else { script->reg_destroy_single(sd,key.i64,&p->flag); } @@ -1025,7 +1025,7 @@ static void intif_parse_Registers(int fd) * { keyLength(B), key(<keyLength>), index(L), valLength(B), val(<valLength>) } **/ if (type) { - char sval[254]; + char sval[SCRIPT_STRING_VAR_LENGTH + 1]; for (i = 0; i < max; i++) { int len = RFIFOB(fd, cursor); safestrncpy(key, RFIFOP(fd, cursor + 1), min((int)sizeof(key), len)); @@ -1035,8 +1035,8 @@ static void intif_parse_Registers(int fd) cursor += 4; 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; script->set_reg(NULL,sd,reference_uid(script->add_variable(key), index), key, sval, NULL); } |