- add additional error checks
git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@63 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
parent
ce3c5e3d57
commit
5295579209
1 changed files with 6 additions and 0 deletions
|
@ -69,6 +69,9 @@ char* strncpy(char *dest, const char *src, size_t n)
|
|||
{
|
||||
size_t i;
|
||||
|
||||
if (BUILTIN_EXPECT(!dest || !src, 0))
|
||||
return dest;
|
||||
|
||||
for (i = 0 ; i < n && src[i] != '\0' ; i++)
|
||||
dest[i] = src[i];
|
||||
if (i < n)
|
||||
|
@ -85,6 +88,9 @@ char* strcpy(char *dest, const char *src)
|
|||
{
|
||||
size_t i;
|
||||
|
||||
if (BUILTIN_EXPECT(!dest || !src, 0))
|
||||
return dest;
|
||||
|
||||
for (i = 0 ; src[i] != '\0' ; i++)
|
||||
dest[i] = src[i];
|
||||
dest[i] = '\0';
|
||||
|
|
Loading…
Add table
Reference in a new issue