From 9a6046f51934f8c34a58583b44cd1dc0c0b0b8d6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 12 Jan 2023 21:57:47 +0100 Subject: m + add libfonts_parse_dir_line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libfonts_parse_alias_line.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libfonts_parse_alias_line.c') diff --git a/libfonts_parse_alias_line.c b/libfonts_parse_alias_line.c index 0496449..3e712e2 100644 --- a/libfonts_parse_alias_line.c +++ b/libfonts_parse_alias_line.c @@ -86,6 +86,11 @@ libfonts_parse_alias_line(enum libfonts_alias_line_type *typep, char **aliasp, c if (namep) *namep = NULL; + if (!line) { + errno = EINVAL; + goto fail; + } + while (isblank(*line)) line++; if (!*line) @@ -132,8 +137,9 @@ fail: *namep = NULL; } ret = -1; - while (*line && *line != '\n') - line++; + if (line) + while (*line && *line != '\n') + line++; out: if (endp) *endp = *(char **)(void *)&line; -- cgit v1.2.3-70-g09d2