(xstrdup): Oops, obviously I calculated the length wrong when

coded this.  Tsss, wrote xstrdup some hundreds times but missed it
this time.  Thanks to Steffen Hansen for noticing it.
This commit is contained in:
Werner Koch 2002-07-01 13:09:18 +00:00
parent 3f7e65f9a9
commit ca43df065f
2 changed files with 5 additions and 1 deletions

View File

@ -14,6 +14,10 @@
malloc. Removed superfluous string termination. malloc. Removed superfluous string termination.
(parseAddress): Use xmalloc instead of an unchecked malloc. (parseAddress): Use xmalloc instead of an unchecked malloc.
(nextAddress): Ditto. (nextAddress): Ditto.
(xstrdup): Oops, obviously I calculated the length wrong when
coded this. Tsss, wrote xstrdup some hundreds times but missed it
this time. Thanks to Steffen Hansen for noticing it.
* gpgmeplug.c: Moved a few helper functions more to the top. * gpgmeplug.c: Moved a few helper functions more to the top.
Fixed comment syntax. Merged a copyright notice somewhere in the Fixed comment syntax. Merged a copyright notice somewhere in the
middle of the file with the one at the top. middle of the file with the one at the top.

View File

@ -239,7 +239,7 @@ xmalloc (size_t n)
static char * static char *
xstrdup (const char *string) xstrdup (const char *string)
{ {
char *p = xmalloc (strlen (string)); char *p = xmalloc (strlen (string)+1);
strcpy (p, string); strcpy (p, string);
return p; return p;
} }