darwin.c (machopic_non_lazy_ptr_name): Fix off by one errors in memcpy destinations.

2003-10-05  Andrew Pinski  <apinski@apple.com>
        * config/darwin.c (machopic_non_lazy_ptr_name): Fix off by one
        errors in memcpy destinations.
        (machopic_stub_name): Likewise.

From-SVN: r72132
This commit is contained in:
Andrew Pinski 2003-10-06 06:11:14 +00:00 committed by Andrew Pinski
parent 6691a79e06
commit ea04c4a331
2 changed files with 12 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2003-10-05 Andrew Pinski <apinski@apple.com>
* config/darwin.c (machopic_non_lazy_ptr_name): Fix off by one
errors in memcpy destinations.
(machopic_stub_name): Likewise.
2003-10-05 Andrew Pinski <apinski@apple.com> 2003-10-05 Andrew Pinski <apinski@apple.com>
* config/darwin.c (machopic_non_lazy_ptr_name): * config/darwin.c (machopic_non_lazy_ptr_name):

View File

@ -304,17 +304,17 @@ machopic_non_lazy_ptr_name (const char *name)
bufferlen = 2; bufferlen = 2;
if (name[0] == '*') if (name[0] == '*')
{ {
memcpy (buffer+bufferlen, name+1, namelen-1+1); memcpy (buffer + bufferlen +1, name+1, namelen-1+1);
bufferlen += namelen-1; bufferlen += namelen-1;
} }
else else
{ {
buffer[bufferlen] = '_'; buffer[bufferlen] = '_';
memcpy (buffer+bufferlen+1, name, namelen+1); memcpy (buffer + bufferlen+1 +1, name, namelen+1);
bufferlen += namelen; bufferlen += namelen;
} }
memcpy (buffer + bufferlen, "$non_lazy_ptr", strlen("$non_lazy_ptr")+1); memcpy (buffer + bufferlen +1, "$non_lazy_ptr", strlen("$non_lazy_ptr")+1);
bufferlen += strlen("$non_lazy_ptr"); bufferlen += strlen("$non_lazy_ptr");
ptr_name = get_identifier (buffer); ptr_name = get_identifier (buffer);
@ -379,24 +379,24 @@ machopic_stub_name (const char *name)
if (name[0] == '*') if (name[0] == '*')
{ {
memcpy (buffer + bufferlen, name+1, namelen - 1 +1); memcpy (buffer + bufferlen +1, name+1, namelen - 1 +1);
bufferlen += namelen - 1; bufferlen += namelen - 1;
} }
else else
{ {
buffer[bufferlen] = '_'; buffer[bufferlen] = '_';
memcpy (buffer + bufferlen +1, name, namelen+1); memcpy (buffer + bufferlen+1 +1, name, namelen+1);
bufferlen += namelen; bufferlen += namelen;
} }
if (needs_quotes) if (needs_quotes)
{ {
memcpy (buffer + bufferlen, "$stub\"", strlen("$stub\"")); memcpy (buffer + bufferlen +1, "$stub\"", strlen("$stub\""));
bufferlen += strlen("$stub\""); bufferlen += strlen("$stub\"");
} }
else else
{ {
memcpy (buffer + bufferlen, "$stub", strlen("$stub")); memcpy (buffer + bufferlen +1, "$stub", strlen("$stub"));
bufferlen += strlen("$stub"); bufferlen += strlen("$stub");
} }
ptr_name = get_identifier (buffer); ptr_name = get_identifier (buffer);