I have a working code on MacOS 10.14 but since I have updated MacOS to catalina 10.15, code compilation is fine but on running it is giving Illegal Instruction - 4. Not running for the input. Has anyone faced any similar issue or any suggestions over this ?
#if __has_builtin(__builtin___strcpy_chk) || defined(__GNUC__)
#undef strcpy
// char *strcpy(char *dst, const char *src)
#define strcpy(dest, ...)
__builtin___strcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
#endif
unsigned char xName[512],yName[512];
char* my_strcpy(char *d, const char* s){
char *r = d;
int local_len=0;
while (*s){
*(d++) = *(s++);
local_len++;
}
*d = '';
return r;
}
- strcpy(xName,yName) crashing
- my_strcpy(xName,yName) working fine.
question from:
https://stackoverflow.com/questions/65873766/facing-illegal-instruction-4-with-macos-catalina-10-15-code-run 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…