Re: xdebug: FTBFS on hurd-i386 (for review)
On Tue, 2014-04-15 at 20:03 +0200, Samuel Thibault wrote:
> Svante Signell, le Tue 15 Apr 2014 16:47:39 +0200, a écrit :
> > Well, freeing tmp instead of dfp in my test program *_old.c gave zero
> > errors in valgrind (as well as the modified program, both attached)
>
> But tmp is not necessarily equal to the original dfp, if you give
> " file://this_is_a_test" for instance.
Yes, you are right! OK now?
--- a/xdebug-2.2.4/usefulstuff.c
+++ b/xdebug-2.2.4/usefulstuff.c
@@ -284,16 +284,15 @@ char *xdebug_raw_url_encode(char const *
char *xdebug_path_from_url(const char *fileurl TSRMLS_DC)
{
/* deal with file: url's */
- char dfp[PATH_MAX * 2];
- const char *fp = dfp, *efp = fileurl;
+ const char *fp = NULL, *efp = fileurl;
#ifdef PHP_WIN32
int l = 0;
int i;
#endif
- char *tmp = NULL, *ret = NULL;;
+ char *dfp = NULL, *tmp = NULL, *ret = NULL;;
- memset(dfp, 0, sizeof(dfp));
- strncpy(dfp, efp, sizeof(dfp) - 1);
+ dfp = xdstrdup(efp);
+ fp = dfp;
xdebug_raw_url_decode(dfp, strlen(dfp));
tmp = strstr(fp, "file://");
@@ -316,6 +315,7 @@ char *xdebug_path_from_url(const char *f
ret = xdstrdup(fileurl);
}
+ free(dfp);
return ret;
}
Reply to: