The gifinto program segfaults when called without arguments.

The reason is NULL beeing supplied to strcpy as address to copy from. I
am not a C Programmer so the attached patch just solves the problem for
the gifinto program, there might be others affected, too since the
*real* Problem seems to be in the commandline parsing of lib/getarg.c,
which is just plain chinese to me.

Perhaps someone with C background is willing to have a look?


Thorsten
Description:    if no Argument is given to gifinto, the program segfaults in
                a strcpy() since Adress 0x0 is given to strcpy.
Author:         Thorsten Happel
Date:           14.11.2011


diff -Naur giflib-4.1.6-orig/util/gifinto.c giflib-4.1.6/util/gifinto.c
--- giflib-4.1.6-orig/util/gifinto.c    2005-10-10 08:22:22.000000000 +0200
+++ giflib-4.1.6/util/gifinto.c 2011-11-14 10:34:47.000000000 +0100
@@ -122,6 +122,7 @@
 
     /* Isolate the directory where our destination is, and set tmp file name */
     /* in the very same directory.                                          */
+    if ( *FileName == NULL ) GIF_EXIT("No valid Filename given.");
     strcpy(FullPath, *FileName);
     if ((p = strrchr(FullPath, '/')) != NULL ||
        (p = strrchr(FullPath, '\\')) != NULL)
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to