From 41ef5f953927150e08d965c486dff4ae3edc7137 Mon Sep 17 00:00:00 2001 From: krangelov Date: Fri, 27 Aug 2021 13:03:11 +0200 Subject: [PATCH] textdup is now safe in case of memory overflow --- src/runtime/c/pgf/text.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/text.cxx b/src/runtime/c/pgf/text.cxx index 949176c94..9b4178582 100644 --- a/src/runtime/c/pgf/text.cxx +++ b/src/runtime/c/pgf/text.cxx @@ -21,7 +21,8 @@ PgfText* textdup(PgfText *t1) { size_t size = sizeof(PgfText)+t1->size+1; PgfText *t2 = (PgfText *) malloc(size); - memcpy(t2, t1, size); + if (t2 != NULL) + memcpy(t2, t1, size); return t2; }