On Fri, Mar 23, 2012 at 11:45 PM, Jan Stary <[email protected]> wrote: > On Mar 23 23:19:02, patrick keshishian wrote: >> On Fri, Mar 23, 2012 at 11:09 PM, Jan Stary <[email protected]> wrote: >> > SoX uses wget(1) to play(1) remote files such as streaming radios. >> > That is in fact a bug in the port (RUN_DEPENDS). Rather than >> > adding wget to DEPENDS, the small patch below replaces that >> > functionality with the base ftp(1). >> > >> > REVISION needs to be bumped I guess. >> > >> > Jan >> > >> > >> > $OpenBSD$ >> > --- src/formats.c.orig Sat Mar 24 06:29:07 2012 >> > +++ src/formats.c Sat Mar 24 06:29:53 2012 >> > @@ -348,7 +348,7 @@ static int sox_checkformat(sox_format_t * ft) >> > return SOX_SUCCESS; >> > } >> > >> > -static sox_bool is_url(char const * text) /* detects only wget-supported >> > URLs */ >> > +static sox_bool is_url(char const * text) >> > { >> > return !( >> > strncasecmp(text, "http:" , (size_t)5) && >> > @@ -385,7 +385,7 @@ static FILE * xfopen(char const * identifier, char con >> > else if (is_url(identifier)) { >> > FILE * f = NULL; >> > #ifdef HAVE_POPEN >> > - char const * const command_format = "wget --no-check-certificate -q >> > -O- \"%s\""; >> > + char const * const command_format = "ftp -a -V -o - \"%s\""; >> > char * command = lsx_malloc(strlen(command_format) + >> > strlen(identifier)); >> >> Whoa ... does lsx_malloc() add an extra byte for the null terminator >> or are we looking at a buffer overrun here? > > The two bytes of "%s" will be replaced, > so I think 'command' has enough bytes.
you are right. >> > sprintf(command, command_format, identifier); >> > f = popen(command, POPEN_MODE);
