phoenix-rtos / phoenix-rtos-project

Sample project using Phoenix-RTOS
https://phoenix-rtos.com
BSD 3-Clause "New" or "Revised" License
44 stars 32 forks source link

Scanf %m character sequence unable to read strings #667

Open maska989 opened 1 year ago

maska989 commented 1 year ago

*Problem occurs when %m is used with other conversion specifiers

Tested between ia32-generic and host-generic

int main(void) { char *str; sscanf("abc", "%ms", &str); printf("\n%s\n", str);

sscanf("abc", "%m[^c]", &str);
printf("\n%s\n", str);

}


* Outcome between ia32-generic and host-generic
![Screenshot from 2023-03-23 11-27-59](https://user-images.githubusercontent.com/49757239/227175654-3517b120-79eb-4dfe-9915-738cad587b5d.png)
maska989 commented 1 year ago

https://github.com/phoenix-rtos/phoenix-rtos-tests/blob/c13ef424dff7c1f0f88f02e4a67104f6d9ed5d22/libc/stdio_scanf.c#L4298 https://github.com/phoenix-rtos/phoenix-rtos-tests/blob/c13ef424dff7c1f0f88f02e4a67104f6d9ed5d22/libc/stdio_scanf.c#L4362 https://github.com/phoenix-rtos/phoenix-rtos-tests/blob/c13ef424dff7c1f0f88f02e4a67104f6d9ed5d22/libc/stdio_scanf.c#L4455