mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 21:15:14 +00:00
LibC: Fix getline() forgetting to null-terminate on EOF
This commit is contained in:
parent
db4da68618
commit
5ba8247cbb
Notes:
sideshowbarker
2024-07-19 08:07:18 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/5ba8247cbbc Pull-request: https://github.com/SerenityOS/serenity/pull/1514
1 changed files with 1 additions and 0 deletions
|
@ -193,6 +193,7 @@ ssize_t getdelim(char** lineptr, size_t* n, int delim, FILE* stream)
|
|||
int c = fgetc(stream);
|
||||
if (c == -1) {
|
||||
if (feof(stream)) {
|
||||
*ptr = '\0';
|
||||
return ptr == *lineptr ? -1 : ptr - *lineptr;
|
||||
} else {
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Reference in a new issue