From 43df0e137bead7ca5affa70b184113d6c387df37 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Tue, 2 Apr 2024 20:41:14 +0300 Subject: [PATCH] pure_getline.c: do not continue if `output` is NULL --- c-programming/io/pure_getline.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/c-programming/io/pure_getline.c b/c-programming/io/pure_getline.c index a7e750c..6017263 100644 --- a/c-programming/io/pure_getline.c +++ b/c-programming/io/pure_getline.c @@ -17,6 +17,11 @@ bool pure_getline(char** output) { * false: an error occurred, see errno */ + if (output == NULL) { + errno = EINVAL; + return false; + } + char* line = NULL; size_t len = 0; int character;