Re: xdebug: FTBFS on hurd-i386 (for review)
Svante Signell, le Wed 16 Apr 2014 10:09:05 +0200, a écrit :
> 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;;
For more readability of the patch, I'd say declare dfp at the same place
it was declared previously. Otherwise the patch looks fine.
> - 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;
> }
>
--
Samuel
<S> KK1 a 1 conseil de comment s'attaquer a du code java ou ya plus de 50 classes ? par kel bout ?
<B> le troisième
-+- #ens-mim en stage -+-
Reply to: