From 3ec96d9e26987697e927498058bdc419017286d6 Mon Sep 17 00:00:00 2001 From: "Emden R. Gansner" Date: Tue, 10 Sep 2013 11:24:16 -0400 Subject: [PATCH] Avoid infinite loop if spurious arrow name is given --- lib/common/arrows.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/common/arrows.c b/lib/common/arrows.c index fa374048b..7e6edd97a 100644 --- a/lib/common/arrows.c +++ b/lib/common/arrows.c @@ -173,12 +173,18 @@ static char *arrow_match_shape(char *name, int *flag) static void arrow_match_name(char *name, int *flag) { char *rest = name; + char *next; int i, f; *flag = 0; for (i = 0; *rest != '\0' && i < NUMB_OF_ARROW_HEADS; ) { f = ARR_TYPE_NONE; - rest = arrow_match_shape(rest, &f); + next = rest; + rest = arrow_match_shape(next, &f); + if (f == ARR_TYPE_NONE) { + agerr(AGWARN, "Arrow type \"%s\" unknown - ignoring\n", next); + return; + } if (f == ARR_TYPE_GAP && i == (NUMB_OF_ARROW_HEADS -1)) f = ARR_TYPE_NONE; if (f != ARR_TYPE_NONE) -- 2.40.0