summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2020-05-10 20:35:59 +0200
committerGitHub <noreply@github.com>2020-05-10 20:35:59 +0200
commit0d66a7243aa6e129cddea4ca09c2616354c23ffa (patch)
tree56fe416e50f56c2265d72b920efd238538ac22ab /src/map/atcommand.c
parent944d8489f1bcca93e6b2ff06a159084f064dce12 (diff)
parent66f9a2a1bc2fd509d13729ad6bc586a3b7ad2347 (diff)
downloadhercules-0d66a7243aa6e129cddea4ca09c2616354c23ffa.tar.gz
hercules-0d66a7243aa6e129cddea4ca09c2616354c23ffa.tar.bz2
hercules-0d66a7243aa6e129cddea4ca09c2616354c23ffa.tar.xz
hercules-0d66a7243aa6e129cddea4ca09c2616354c23ffa.zip
Merge pull request #2705 from Kenpachi2k13/string_var_size
Cap string variable value length and unify corresponding SQL columns size
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 3fe6c8581..54cc9e2c9 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8916,13 +8916,17 @@ ACMD(accinfo)
/* [Ind] */
ACMD(set)
{
- char reg[SCRIPT_VARNAME_LENGTH+1], val[254];
+ char reg[SCRIPT_VARNAME_LENGTH + 1];
+ char val[SCRIPT_STRING_VAR_LENGTH + 1];
struct script_data* data;
int toset = 0;
bool is_str = false;
size_t len;
- if (!*message || (toset = sscanf(message, "%32s %253[^\n]", reg, val)) < 1) {
+ char format[20];
+ safesnprintf(format, sizeof(format), "%%%ds %%%d[^\\n]", SCRIPT_VARNAME_LENGTH, SCRIPT_STRING_VAR_LENGTH);
+
+ if (*message == '\0' || (toset = sscanf(message, format, reg, val)) < 1) {
clif->message(fd, msg_fd(fd,1367)); // Usage: @set <variable name> <value>
clif->message(fd, msg_fd(fd,1368)); // Usage: ex. "@set PoringCharVar 50"
clif->message(fd, msg_fd(fd,1369)); // Usage: ex. "@set PoringCharVarSTR$ Super Duper String"