Replace strcpy with memcpy when we have the length around anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94746 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2010-01-28 18:04:38 +00:00
parent 2c47368a7d
commit 12ea66a727
5 changed files with 14 additions and 14 deletions

View File

@ -368,7 +368,7 @@ GenericValue lle_X_sprintf(const FunctionType *FT,
switch (Last) {
case '%':
strcpy(Buffer, "%"); break;
memcpy(Buffer, "%", 2); break;
case 'c':
sprintf(Buffer, FmtBuf, uint32_t(Args[ArgNo++].IntVal.getZExtValue()));
break;
@ -400,8 +400,9 @@ GenericValue lle_X_sprintf(const FunctionType *FT,
errs() << "<unknown printf code '" << *FmtStr << "'!>";
ArgNo++; break;
}
strcpy(OutputBuffer, Buffer);
OutputBuffer += strlen(Buffer);
size_t Len = strlen(Buffer);
memcpy(OutputBuffer, Buffer, Len + 1);
OutputBuffer += Len;
}
break;
}