summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-07-11 16:57:14 -0300
committershennetsind <ind@henn.et>2013-07-11 16:57:14 -0300
commitaea85418b727d35083733f63d75734096a5fb57c (patch)
tree5108202d287d8cbf963168886d66da4f938a37f9
parent1584c6d40eac87a0145cfdf42e51b8aacb19d28a (diff)
parent8efd1656864cb9e96cd76a5331cf3286e0ca3695 (diff)
downloadhercules-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.c9
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;
}
}