Package list unrtf / 195636a debian / patches / 0005-attr_get_param-Silence-a-warning-message-again.patch
195636a

Tree @195636a (Download .tar.gz)

0005-attr_get_param-Silence-a-warning-message-again.patch @195636araw · history · blame

From: Fabian Keil <fk@fabiankeil.de>
Date: Thu, 4 Dec 2014 18:20:12 +0100
Subject: attr_get_param(): Silence a warning message again

attr_get_param(ATTR_ENCODING) is always called once without a stack
being available, but previously the use-after-free prevented the
warning.
---
 src/attr.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/attr.c b/src/attr.c
index 2c2552b..0337fd0 100644
--- a/src/attr.c
+++ b/src/attr.c
@@ -348,8 +348,14 @@ attr_get_param(int attr)
 	int i;
 	AttrStack *stack = stack_of_stacks_top;
 	if (!stack) {
-		warning_handler("No stack to get attribute from");
-		return;
+		if (attr != ATTR_ENCODING) {
+			/*
+			 * attr_get_param(ATTR_ENCODING) is always called
+			 * called once without a stack being available.
+			 */
+			warning_handler("No stack to get attribute from");
+		}
+		return NULL;
 	}
 
 	i=stack->tos;