From f213b3aed67a4f527cdf1e36e704d06f01a8fc31 Mon Sep 17 00:00:00 2001 From: Sagar Ladla Date: Tue, 30 Apr 2024 21:07:54 +0530 Subject: [PATCH] Add support for scanf to accept formatted modified: src/lib/libc/scanf.c - buffer allocation modified to heap from stack --- src/lib/libc/scanf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/libc/scanf.c b/src/lib/libc/scanf.c index b5b7591c..f28a2bbb 100644 --- a/src/lib/libc/scanf.c +++ b/src/lib/libc/scanf.c @@ -182,7 +182,7 @@ int scanf(const char * restrict fmt, ...) } case 'f': { - char buff[50]; + char *buff = (char *)malloc(sizeof(char) * 50); gets(buff); *(float *)va_arg(ap, float *) = (float)atof(buff); count++;