From: mquinson Date: Wed, 25 May 2005 11:13:20 +0000 (+0000) Subject: Bugfix: Allow absolute paths for platform description files; don't trust strlen to... X-Git-Tag: v3.3~4065 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/64475c65e715e134d5a72931863896eb5d43fd32?hp=e9869546955549027a1680253a3402d72f4d8e03 Bugfix: Allow absolute paths for platform description files; don't trust strlen to get the size of the malloced buffer. It can be smaller if the string does not fill the space git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1290 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/surf/surf.c b/src/surf/surf.c index e26ec9b66b..334fc64afe 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -169,20 +169,31 @@ FILE *surf_fopen(const char *name, const char *mode) int i; char* path = NULL; FILE *file = NULL; + int path_name_len = 0; /* don't count '\0' */ - xbt_assert1((name!=NULL), "Need a real file name, not \"%s\"\n",name); + xbt_assert0(name, "Need a non-NULL file name"); xbt_assert0(surf_path,"surf_init has to be called before using surf_fopen"); - if(!path_name) path_name=xbt_new0(char,strlen(name)+1); - - xbt_dynar_foreach(surf_path,i,path) { - if(strlen(path_name)