bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] Wget only runs once - need a bit of advice.


From: Colin Bell
Subject: [Bug-wget] Wget only runs once - need a bit of advice.
Date: Mon, 16 Jul 2012 14:42:58 +0100

Hi all

I have a modified version of wget 1.13.4 which allows it to run as a
library. Code can be found here http://pastie.org/pastes/4266045/text

It works well except for the fact that it will only run once. If I execute
the wget method again it stops because it fails to pass a buffer check (see
code below). Can anyone give me some ideas on what I'm missing here?

Thanks everyone, very much appreciated.

static char *
no_prefix (const char *s)
{
  static char buffer[1024];
  static char *p = buffer;

  char *cp = p;
  int size = 3 + strlen (s) + 1;  /* "no-STRING\0" */
  if (p + size >= buffer + sizeof (buffer))
    abort (); <---- *Exits here*

  cp[0] = 'n', cp[1] = 'o', cp[2] = '-';
  strcpy (cp + 3, s);
  p += size;
  return cp;
}


reply via email to

[Prev in Thread] Current Thread [Next in Thread]