On Fri, Jun 24, 2011 at 09:49:31PM +0300, Daniel Shahaf wrote:
> > +#ifndef MAGIC_MIME_TYPE
> > +             char *p;
> > +
> > +             /* Strip off trailing stuff like " charset=ascii". */
> > +             p = strchr(magic_mimetype, ' ');
> > +             if (p)
> > +              *p = '\0';
> 
> What is 'magic_mimetype' here?  Is it guaranteed to contain a space, or
> can it be 'text/plain;charset=ascii' ?

In all examples I've seen it was a space.
I suppose the only canonical reference on this is the libmagic
source code, since this is not standardized in any way.

> i.e., should the strchr look for a semicolon?

I would only add that if we get someone reporting a bug about it.

You see, if this value is bogus in some way, it will not pass the
subsequent mime-type syntax validation step. So we will never use it
and just fall back to what we did without libmagic.
So this is not a big issue. It's cosmetic.

Reply via email to