Berry input() returns empty string and does not crash (#21565)

This commit is contained in:
s-hadinger 2024-06-04 23:30:01 +02:00 committed by GitHub
parent 89b4376e31
commit 9e168d84d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
### Changed
### Fixed
- Berry `input()` returns empty string and does not crash
### Removed

View File

@ -216,7 +216,10 @@ extern "C" {
BERRY_API char* be_readstring(char *buffer, size_t size)
{
return be_fgets(stdin, buffer, (int)size);
if ((size > 0) && (buffer != NULL)) {
*buffer = 0;
}
return buffer;
}
/* use the standard library implementation file API. */