Skip to content

Commit

Permalink
<Libc> Add support for scanf to accept formatted
Browse files Browse the repository at this point in the history
modified:   src/lib/libc/scanf.c

- buffer allocation modified to heap from stack
  • Loading branch information
sagarladla committed Apr 30, 2024
1 parent 99b57ae commit a099ef0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/libc/scanf.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ int scanf(const char * restrict fmt, ...)
}
case 'f':
{
char buff[50];
char *buff = (char *)malloc(sizeof(char) * 50);
gets(buff);

Check failure

Code scanning / CodeQL

Use of dangerous function Critical

'gets' does not guard against buffer overflow.
*(float *)va_arg(ap, float *) = (float)atof(buff);
count++;
Expand Down

0 comments on commit a099ef0

Please sign in to comment.