mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-07 01:06:54 +08:00
Fix potential memory issue discovered by clang's analyzer
This commit is contained in:
parent
c0bf6ee99d
commit
28a016b51d
@ -23,7 +23,8 @@ char *mystrdup (const char *s) {
|
||||
#ifdef CHAISCRIPT_MSVC
|
||||
strcpy_s(d, len, s); // Copy the characters
|
||||
#else
|
||||
strcpy(d,s); // Copy the characters
|
||||
strncpy(d,s,len); // Copy the characters
|
||||
d[len] = '\0';
|
||||
#endif
|
||||
return d; // Return the new string
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user