summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-18 16:23:00 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-18 16:23:00 +0000
commita7cff17e9b9140a2dd5e883e5c337b7a5da6abeb (patch)
tree12c6a8f81080d901b27996badaf30acb05dac977 /src
parenteedd140ce4817098af82aa26d1e4af02873b5e3c (diff)
Improved layout of /version, used strtok_r to prevent buffer whacking
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@648 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/inspircd.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 64686448e..4e5b5c0be 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -5056,8 +5056,14 @@ void ConnectUser(userrec *user)
void handle_version(char **parameters, int pcnt, userrec *user)
{
char Revision[] = "$Revision$";
- char *v1 = strtok(Revision," ");
- char *v2 = strtok(NULL," ");
+
+ char *s1 = Revision;
+ char *savept;
+ char *v1 = strtok_r(s1," ",&savept);
+ s1 = savept;
+ char *v2 = strtok_r(s1," ",&savept);
+ s1 = savept;
+
WriteServ(user->fd,"351 %s :%s Rev. %s %s :%s (O=%d)",user->nick,VERSION,v2,ServerName,SYSTEM,OPTIMISATION);
}