[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#123272: crash segfaults on wrong command line input



tags 123272 patch
thanks

I did a patch for this crappy (non-)indented C source code.
It will go in my upload in a few hours...

Cheers,
-- 
 .''`.   Aurélien GÉRÔME
: :'  :  
`. `'`   Free Software Developer
  `-     Unix Sys & Net Admin
--- crashme.c.orig	2006-07-30 22:49:29.783683189 +0000
+++ crashme.c	2006-07-30 22:51:12.220385807 +0000
@@ -391,7 +391,9 @@
    old_main(4,argv);
  else if ((argc == 6) && ((strlen(argv[4]) == 0) ||
 			  (strcmp(argv[4],".") == 0)))
-   {verbose_level = atol(argv[5]);
+   {
+    if (strlen(argv[4]) == 0) goto exit;
+    verbose_level = atol(argv[5]);
     old_main(4,argv);}
  else if ((argc == 5) || (argc == 6))
    {if (argc == 6)
@@ -420,7 +422,9 @@
     note(1);
     vfork_main(tflag,nsubs,argv[0],argv[1],atol(argv[2]),argv[3]);}
  else
-   {sprintf(notes,
+   {
+exit:
+    sprintf(notes,
 	    "crashme [+]<nbytes>[.inc] <srand> <ntrys> [nsub] [verbose]");
     note(0);}}
 

Attachment: signature.asc
Description: Digital signature


Reply to: