mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
ffserver: Fix off by 1 error in path
Code suggested by ubitux Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 617f0c65e1bac8983a5b6521818c1b9b57f0804b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
e8fd32b69f
commit
0ccb27e094
22
ffserver.c
22
ffserver.c
@ -476,7 +476,7 @@ static int compute_datarate(DataRateData *drd, int64_t count)
|
|||||||
static void start_children(FFServerStream *feed)
|
static void start_children(FFServerStream *feed)
|
||||||
{
|
{
|
||||||
char *pathname;
|
char *pathname;
|
||||||
char *slash;
|
char *dirname, *prog;
|
||||||
int i;
|
int i;
|
||||||
size_t cmd_length;
|
size_t cmd_length;
|
||||||
|
|
||||||
@ -495,22 +495,18 @@ static void start_children(FFServerStream *feed)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
slash = strrchr(my_program_name, '/');
|
/* use "ffmpeg" in the path of current program. Ignore user provided path */
|
||||||
if (!slash) {
|
prog = av_strdup(my_program_name);
|
||||||
pathname = av_mallocz(sizeof("ffmpeg"));
|
if (prog) {
|
||||||
} else {
|
dirname = av_dirname(prog);
|
||||||
pathname = av_mallocz(slash - my_program_name + sizeof("ffmpeg"));
|
pathname = *dirname ? av_asprintf("%s/%s", dirname, "ffmpeg")
|
||||||
if (pathname != NULL) {
|
: av_asprintf("ffmpeg");
|
||||||
memcpy(pathname, my_program_name, slash - my_program_name);
|
av_free(prog);
|
||||||
}
|
}
|
||||||
}
|
if (!prog || !pathname) {
|
||||||
if (!pathname) {
|
|
||||||
http_log("Could not allocate memory for children cmd line\n");
|
http_log("Could not allocate memory for children cmd line\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* use "ffmpeg" in the path of current program. Ignore user provided path */
|
|
||||||
|
|
||||||
strcat(pathname, "ffmpeg");
|
|
||||||
|
|
||||||
for (; feed; feed = feed->next) {
|
for (; feed; feed = feed->next) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user