[MPlayer-cvslog] r30980 - trunk/stream/http.c

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Apr 2 09:10:23 CEST 2010


On Fri, Apr 02, 2010 at 03:01:18AM +0400, Yuriy Kaminskiy wrote:
> On 31.03.2010 23:42, reimar wrote:
> > Author: reimar
> > Date: Wed Mar 31 21:42:15 2010
> > New Revision: 30980
> > 
> > Log:
> > Sanitize ICY metadata a bit before printing it.
> > 
> > Modified:
> >    trunk/stream/http.c
> > 
> > Modified: trunk/stream/http.c
> > ==============================================================================
> > --- trunk/stream/http.c	Wed Mar 31 20:45:00 2010	(r30979)
> > +++ trunk/stream/http.c	Wed Mar 31 21:42:15 2010	(r30980)
> > @@ -124,8 +124,13 @@ static void scast_meta_read(int fd, stre
> >    my_read(fd, &tmp, 1, sc);
> >    metalen = tmp * 16;
> >    if (metalen > 0) {
> > +    int i;
> >      char *info = malloc(metalen + 1);
> >      unsigned nlen = my_read(fd, info, metalen, sc);
> > +    // avoid breaking the user's terminal too much
> > +    if (nlen > 256) nlen = 256;
> > +    for (i = 0; i < nlen; i++)
> > +      if (info[i] && info[i] < 32) info[i] = '?';
> This would produce different result depending on 'char' type signedness
> ([\x80..\xff]).
> I think, it should either use isprint(info[i]), or explicit (un)signed char type
> for info.

It should use unsigned, the idea was that it shouldn't break UTF-8.


More information about the MPlayer-cvslog mailing list