adds terminator to char str in wrap_puts

This commit is contained in:
2025-10-24 10:05:55 +02:00
parent 703fbf67b4
commit fced281870

View File

@@ -4,10 +4,12 @@
extern ssize_t _bsp_write(int, const void*, size_t);
int __wrap_puts(const char* s) {
const char* str = s;
while(*str)
str++;
return _bsp_write(STDOUT_FILENO, s, str - s);
int __wrap_puts(const char* s) {
if(!s) return -1;
const char* str = s;
while(*str)
++str;
*(char*)str='\n';
return _bsp_write(STDOUT_FILENO, s, (str - s)+1);
}
weak_under_alias(puts);
weak_under_alias(puts);