[Extractor-gtk-cvslog] SF.net SVN: extractor-gtk: [60] trunk/extractor/helpers.c
Extract files from unusual archive formats
Brought to you by:
someone-guy
From: <som...@us...> - 2008-02-22 22:14:46
|
Revision: 60 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=60&view=rev Author: someone-guy Date: 2008-02-22 14:14:43 -0800 (Fri, 22 Feb 2008) Log Message: ----------- Add maximum size for C string read from file Modified Paths: -------------- trunk/extractor/helpers.c Modified: trunk/extractor/helpers.c =================================================================== --- trunk/extractor/helpers.c 2008-02-22 22:14:31 UTC (rev 59) +++ trunk/extractor/helpers.c 2008-02-22 22:14:43 UTC (rev 60) @@ -12,6 +12,7 @@ #include "formats.h" #define DEF_CSTR_SIZE 32 +#define MAX_CSTR_SIZE 1024 /** * \brief read a C string (0-terminated) from a file * \param f file to read from, starting at current position @@ -21,6 +22,7 @@ char *name = malloc(DEF_CSTR_SIZE); int size = DEF_CSTR_SIZE, used = 0; while ((name[used++] = fgetc(f))) { + if (used == MAX_CSTR_SIZE) break; if (used == size) { size *= 2; name = realloc(name, size); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |