Enlightenment CVS committal Author : raster Project : e17 Module : libs/embryo
Dir : e17/libs/embryo/src/bin Modified Files: embryo_cc_sc1.c Log Message: fix path string stuff to not be able to overflow (unlikely tho - ever) =================================================================== RCS file: /cvs/e/e17/libs/embryo/src/bin/embryo_cc_sc1.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -3 -r1.34 -r1.35 --- embryo_cc_sc1.c 25 Nov 2007 11:38:49 -0000 1.34 +++ embryo_cc_sc1.c 24 Jan 2008 00:25:13 -0000 1.35 @@ -21,7 +21,7 @@ * must not be misrepresented as being the original software. * 3. This notice may not be removed or altered from any source * distribution. - * Version: $Id: embryo_cc_sc1.c,v 1.34 2007/11/25 11:38:49 doursse Exp $ + * Version: $Id: embryo_cc_sc1.c,v 1.35 2008/01/24 00:25:13 raster Exp $ */ #ifdef HAVE_CONFIG_H @@ -697,7 +697,11 @@ /* add the default "include" directory */ if (root != NULL) - strcpy(path, root); /* path + filename (hopefully) */ + { + /* path + filename (hopefully) */ + strncpy(path, root, sizeof(path) - 1); + path[sizeof(path) - 1] = 0; + } /* terminate just behind last \ or : */ if ((ptr = strrchr(path, DIRSEP_CHAR)) != NULL || (ptr = strchr(path, ':')) != NULL) @@ -708,7 +712,10 @@ * to the list in that case */ *(ptr + 1) = '\0'; - strcat(path, "include"); + if (strlen(path) < (sizeof(path) - 1 - 7)) + { + strcat(path, "include"); + } len = strlen(path); path[len] = DIRSEP_CHAR; path[len + 1] = '\0'; ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs