summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-04-28 15:53:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-05-06 17:47:11 -0700
commit36e461f8b3cfc7133801ec95ca31a363819ed91a (patch)
tree079b92531fbfed570558a61ab1bda5a005ec7507
parentb4461cb5b2627709ba8a7be3ba7c608bbf482c46 (diff)
SetFontCatalogue: handle allocation failure
difs/fonts.c: In function ‘SetFontCatalogue’: difs/fonts.c:766:14: warning: dereference of possibly-NULL ‘p’ [CWE-690] [-Wanalyzer-possible-null-dereference] 766 | *p++ = len = end - str; | ~~~~~^~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/app/xfs/-/merge_requests/7>
-rw-r--r--difs/fonts.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/difs/fonts.c b/difs/fonts.c
index a745503..7b234bb 100644
--- a/difs/fonts.c
+++ b/difs/fonts.c
@@ -757,6 +757,8 @@ SetFontCatalogue(
len = strlen(str) + 1;
paths = p = (char *) ALLOCATE_LOCAL(len);
npaths = 0;
+ if (p == NULL)
+ return FSBadAlloc;
while (*str) {
end = index(str, ',');