[vorbis-dev] More changes to the win32 build environment

Matthijs Laan matthijsln at xs4all.nl
Sun Oct 21 05:43:39 PDT 2001



On Sat 20 Oct 2001 23:43:07, "Chris Wolf" <cwolf at starclass.com> wrote:

> I made some changes to the win32 build environment.

Working great!

Just found a bug in my code:

  for(i=1;i<argc;i++)
  {
    if(strlen(argv[i])>(size_t)(BUF_SIZE-c))
    {
      (void)fprintf(stderr, "Command line too long\n");
      exit(1);
    }

    strcat(cmdline, argv[i]);
    strcat(cmdline, " ");
    c+=strlen(argv[i]);
  }

Should of course be

  for(i=1;i<argc;i++)
  {
    if((strlen(argv[i])+strlen(" "))>(size_t)(BUF_SIZE-c))
    {
      (void)fprintf(stderr, "Command line too long\n");
      exit(1);
    }

    strcat(cmdline, argv[i]);
    strcat(cmdline, " ");
    c+=strlen(argv[i])+strlen(" ");
  }

That's what you get when you're spoiled with automatic strings...

Matthijs

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list