diff options
author | Haru <haru@dotalux.com> | 2014-08-07 03:39:13 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2014-08-07 05:37:38 +0200 |
commit | c45e3fa9793a273a0eab40d1626bcda7d710552c (patch) | |
tree | 4f6c9d47770a15c8cbfe065f7ee9203f77e57022 /src/char/inter.c | |
parent | caf89724767465ecf339c391bb6d7a937d563fb2 (diff) | |
download | hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.gz hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.bz2 hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.xz hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.zip |
Corrected several format-string errors through the code
- Functions that expect a printf-style format string are now marked as
such, so that gcc/clang will emit a warning warn you if you mismatch
format string and arguments.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char/inter.c')
-rw-r--r-- | src/char/inter.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/char/inter.c b/src/char/inter.c index c2d8de37a..ab53fc6da 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -107,7 +107,7 @@ bool msg_config_read(const char *cfg_name, bool allow_override) { while(fgets(line, sizeof(line), fp) ) { if (line[0] == '/' && line[1] == '/') continue; - if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2) + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) continue; if (strcmpi(w1, "import") == 0) @@ -562,7 +562,8 @@ void inter_vmsg_to_fd(int fd, int u_fd, int aid, char* msg, va_list ap) { * @param msg Message format string * @param ... Additional parameters for (v)sprinf */ -void inter_msg_to_fd(int fd, int u_fd, int aid, char* msg, ...) { +void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); +void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) { va_list ap; va_start(ap,msg); inter_vmsg_to_fd(fd, u_fd, aid, msg, ap); @@ -917,9 +918,8 @@ static int inter_config_read(const char* cfgName) return 1; } - while(fgets(line, sizeof(line), fp)) - { - i = sscanf(line, "%[^:]: %[^\r\n]", w1, w2); + while (fgets(line, sizeof(line), fp)) { + i = sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2); if(i != 2) continue; |