diff options
author | shennetsind <ind@henn.et> | 2013-07-11 16:57:14 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-07-11 16:57:14 -0300 |
commit | aea85418b727d35083733f63d75734096a5fb57c (patch) | |
tree | 5108202d287d8cbf963168886d66da4f938a37f9 | |
parent | 1584c6d40eac87a0145cfdf42e51b8aacb19d28a (diff) | |
parent | 8efd1656864cb9e96cd76a5331cf3286e0ca3695 (diff) | |
download | hercules-aea85418b727d35083733f63d75734096a5fb57c.tar.gz hercules-aea85418b727d35083733f63d75734096a5fb57c.tar.bz2 hercules-aea85418b727d35083733f63d75734096a5fb57c.tar.xz hercules-aea85418b727d35083733f63d75734096a5fb57c.zip |
Merge branch 'master' of https://github.com/HerculesWS/Hercules
-rw-r--r-- | src/map/irc-bot.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index 0be8074c8..d3782bd9b 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -120,15 +120,12 @@ void irc_parse_source(char *source, char *nick, char *ident, char *host) { for(i = 0; i < len; i++) { if( stage == 0 && source[i] == '!' ) { - memcpy(nick, &source[0], min(i,IRC_NICK_LENGTH)); - nick[i] = '\0'; + safestrncpy(nick, &source[0], min(i + 1, IRC_NICK_LENGTH)); pos = i+1; stage = 1; } else if( stage == 1 && source[i] == '@' ) { - memcpy(ident, &source[pos], min(i - pos,IRC_IDENT_LENGTH)); - ident[i-pos] = '\0'; - memcpy(host, &source[i+1], min(len - i,IRC_HOST_LENGTH)); - host[len] = '\0'; + safestrncpy(ident, &source[pos], min(i - pos + 1, IRC_IDENT_LENGTH)); + safestrncpy(host, &source[i+1], min(len - i, IRC_HOST_LENGTH)); break; } } |