Permalink
Browse files

Fix username parsing

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
  • Loading branch information...
stefanha committed Sep 30, 2014
1 parent 479e3ba commit ddf55c6497ed335444951d1affab48208dc6ac50
Showing with 9 additions and 1 deletion.
  1. +9 −1 cliplogcvt/cliplogcvt.cpp
View
@@ -517,6 +517,14 @@ static bool parseCliplog(FILE *logfile, UserChannelList localrecs[32],
}
std::string username = fields[2];
if (username.size() < 2 ||
username[0] != '"' ||
username[username.size() - 1] != '"') {
printf("user line has invalid username\n");
return false;
}
username = username.substr(1, username.size() - 2);
int chidx = atoi(fields[3].c_str());
UserChannelValueRec *ucvr = new UserChannelValueRec;
@@ -604,7 +612,7 @@ int main(int argc, char **argv)
for (x= 0; x < curintrecs.size(); x ++)
{
char chname[4096];
sprintf(chname, "%s_%02d", curintrecs[x]->user.c_str(), x);
snprintf(chname, sizeof(chname), "%s_%02d", curintrecs[x]->user.c_str(), x);
char *p=chname;
while (*p)
{

0 comments on commit ddf55c6

Please sign in to comment.