From f5ac2689895f48509211ed99fcdcf2f069d2d7de Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sun, 12 Jun 2022 16:36:35 +0200 Subject: [PATCH] Fix unchecked realloc in `makeUnknown` --- src/asm/rpn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/asm/rpn.c b/src/asm/rpn.c index cabc26bc..b2fe20ae 100644 --- a/src/asm/rpn.c +++ b/src/asm/rpn.c @@ -39,6 +39,8 @@ int size = snprintf(_expr->reason, 128, __VA_ARGS__); \ if (size >= 128) { /* If this wasn't enough, try again */ \ _expr->reason = realloc(_expr->reason, size + 1); \ + if (!_expr->reason) \ + fatalerror("Can't allocate err string: %s\n", strerror(errno)); \ sprintf(_expr->reason, __VA_ARGS__); \ } \ } while (0)