John Keeping <[email protected]> on Sat, 2015/08/15 12:29:
> > +                   /* loop over all lines in the file */
> > +                   while (!*mimetype && fgets(line, sizeof(line),
> > fd)) {
> > +                           iterate = strtok(line, delimiters);
> > +
> > +                           /* skip empty lines and comment lines */
> > +                           if (!iterate || (iterate[0] == '#'))
> > +                                   continue;
> > +
> > +                           /* loop over all extensions of mimetype
> > */
> > +                           while ((token = strtok(NULL,
> > delimiters))) {
> > +                                   if (!strcasecmp(ext, token)) {
> > +                                           *mimetype = iterate;  
> 
> Doesn't this result in us reading stale memory in the caller?
> "iterate" derives from "line" which is on the stack.

This used to work, probably just as long as we do not call strtok() again. I
addressed that in my updated patches.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}

Attachment: pgpBQswV0vs_2.pgp
Description: OpenPGP digital signature

_______________________________________________
CGit mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/cgit

Reply via email to