diff options
author | erdgeist <> | 2003-04-03 09:16:42 +0000 |
---|---|---|
committer | erdgeist <> | 2003-04-03 09:16:42 +0000 |
commit | 06105a7dd103962ed001fa1f1e05c2090d5e0c2e (patch) | |
tree | f12585aee40d2f231a446009bf2b6932d6cf50f1 /vchat-client.c | |
parent | 64c5c684a45fd9b4cfd09519b90d206d37c12876 (diff) |
Buffer overflow check
Diffstat (limited to 'vchat-client.c')
-rwxr-xr-x | vchat-client.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/vchat-client.c b/vchat-client.c index ae369ab..039301e 100755 --- a/vchat-client.c +++ b/vchat-client.c | |||
@@ -108,6 +108,8 @@ static void parseformats(unsigned char *line) { | |||
108 | 108 | ||
109 | while( *line == ' ') line++; | 109 | while( *line == ' ') line++; |
110 | 110 | ||
111 | if( strlen( line ) > TMPSTRSIZE ) return; | ||
112 | |||
111 | if( *line != '#') /* allow to comment out the line */ | 113 | if( *line != '#') /* allow to comment out the line */ |
112 | for (i = 0; formatstrings[i].formatstr; i++) | 114 | for (i = 0; formatstrings[i].formatstr; i++) |
113 | if (!strncasecmp(formatstrings[i].idstring, line, strlen( formatstrings[i].idstring) )) | 115 | if (!strncasecmp(formatstrings[i].idstring, line, strlen( formatstrings[i].idstring) )) |
@@ -379,7 +381,7 @@ cleanup (int signal) | |||
379 | { | 381 | { |
380 | fprintf (stderr, "vchat-client: terminated with signal %d.\n", signal); | 382 | fprintf (stderr, "vchat-client: terminated with signal %d.\n", signal); |
381 | } else if (errstr[0]) | 383 | } else if (errstr[0]) |
382 | fprintf (stderr, errstr); | 384 | fputs (errstr, stderr); |
383 | /* end of story */ | 385 | /* end of story */ |
384 | exit (0); | 386 | exit (0); |
385 | } | 387 | } |
@@ -435,19 +437,19 @@ eventloop (void) | |||
435 | } | 437 | } |
436 | 438 | ||
437 | void usage(unsigned char *name) { | 439 | void usage(unsigned char *name) { |
438 | printf("usage: %s [-C config-file] [-l] [-z] [-s host] [-p port] [-c channel] [-n nickname]\n",name); | 440 | printf ("usage: %s [-C config-file] [-l] [-z] [-s host] [-p port] [-c channel] [-n nickname]\n",name); |
439 | printf(" -C load a second config-file, overriding the first one\n"); | 441 | puts (" -C load a second config-file, overriding the first one\n"); |
440 | printf(" -l local connect (no SSL + connects localhost:2323)\n"); | 442 | puts (" -l local connect (no SSL + connects localhost:2323)\n"); |
441 | printf(" -z don't use certificate files\n"); | 443 | puts (" -z don't use certificate files\n"); |
442 | printf(" -s set server (default \"%s\")\n",getstroption(CF_SERVERHOST)); | 444 | printf (" -s set server (default \"%s\")\n",getstroption(CF_SERVERHOST)); |
443 | printf(" -p set port (default %d)\n",getintoption(CF_SERVERPORT)); | 445 | printf (" -p set port (default %d)\n",getintoption(CF_SERVERPORT)); |
444 | printf(" -c set channel (default %d)\n",getintoption(CF_CHANNEL)); | 446 | printf (" -c set channel (default %d)\n",getintoption(CF_CHANNEL)); |
445 | if (nick) | 447 | if (nick) |
446 | printf(" -n set nickname (default \"%s\")\n",nick); | 448 | printf(" -n set nickname (default \"%s\")\n",nick); |
447 | else | 449 | else |
448 | printf(" -n set nickname\n"); | 450 | puts (" -n set nickname\n"); |
449 | printf(" -f set from (default \"%s\")\n",getstroption(CF_FROM)); | 451 | printf (" -f set from (default \"%s\")\n",getstroption(CF_FROM)); |
450 | printf(" -h gives this help\n"); | 452 | puts (" -h gives this help\n"); |
451 | } | 453 | } |
452 | 454 | ||
453 | /* main - d'oh */ | 455 | /* main - d'oh */ |