Re: [FFmpeg-devel] [PATCH 1/2] ffserver: Fix off by 1 error in path
On Mon, Oct 23, 2017 at 10:44:07AM +0200, Clément Bœsch wrote: > On Mon, Oct 23, 2017 at 10:42:53AM +0200, Clément Bœsch wrote: > [...] > > how about changing the whole chunk with (untested): > > > > prog = av_strdup(my_program_name); > > dirname = av_dirname(prog); > > pathname = *dirname ? av_asprintf("%s/%s", dirname, "ffmpeg") > > : av_asprintf("ffmpeg") > > av_free(filepath); > > prog works fine, will push with this thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] ffserver: Fix off by 1 error in path
On Mon, Oct 23, 2017 at 10:42:53AM +0200, Clément Bœsch wrote: [...] > how about changing the whole chunk with (untested): > > prog = av_strdup(my_program_name); > dirname = av_dirname(prog); > pathname = *dirname ? av_asprintf("%s/%s", dirname, "ffmpeg") > : av_asprintf("ffmpeg") > av_free(filepath); prog -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] ffserver: Fix off by 1 error in path
On Sun, Oct 22, 2017 at 05:11:20PM +0200, Michael Niedermayer wrote: > Signed-off-by: Michael Niedermayer> --- > fftools/ffserver.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fftools/ffserver.c b/fftools/ffserver.c > index d4885dfa0e..51f31bc704 100644 > --- a/fftools/ffserver.c > +++ b/fftools/ffserver.c > @@ -499,9 +499,9 @@ static void start_children(FFServerStream *feed) > if (!slash) { > pathname = av_mallocz(sizeof("ffmpeg")); > } else { > -pathname = av_mallocz(slash - my_program_name + sizeof("ffmpeg")); > +pathname = av_mallocz(slash - my_program_name + 1 + > sizeof("ffmpeg")); > if (pathname != NULL) { > -memcpy(pathname, my_program_name, slash - my_program_name); > +memcpy(pathname, my_program_name, slash - my_program_name + 1); > } maybe that's correct but the whole code around here needs rewrite. how about changing the whole chunk with (untested): prog = av_strdup(my_program_name); dirname = av_dirname(prog); pathname = *dirname ? av_asprintf("%s/%s", dirname, "ffmpeg") : av_asprintf("ffmpeg") av_free(filepath); -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] ffserver: Fix off by 1 error in path
Signed-off-by: Michael Niedermayer--- fftools/ffserver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/ffserver.c b/fftools/ffserver.c index d4885dfa0e..51f31bc704 100644 --- a/fftools/ffserver.c +++ b/fftools/ffserver.c @@ -499,9 +499,9 @@ static void start_children(FFServerStream *feed) if (!slash) { pathname = av_mallocz(sizeof("ffmpeg")); } else { -pathname = av_mallocz(slash - my_program_name + sizeof("ffmpeg")); +pathname = av_mallocz(slash - my_program_name + 1 + sizeof("ffmpeg")); if (pathname != NULL) { -memcpy(pathname, my_program_name, slash - my_program_name); +memcpy(pathname, my_program_name, slash - my_program_name + 1); } } if (!pathname) { -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel