From 3686645e775dafd7feb8452cc3e9d76445180237 Mon Sep 17 00:00:00 2001 From: Ray Lai Date: Tue, 2 Jun 2009 11:14:08 +0000 Subject: Don't dereference NULL if buf winds up being empty. Can't happen right now according to NicM but better safe than sorry. OK nicm@ --- attributes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'attributes.c') diff --git a/attributes.c b/attributes.c index cfe46ecd..36b34ff1 100644 --- a/attributes.c +++ b/attributes.c @@ -45,7 +45,8 @@ attributes_tostring(u_char ch) strlcat(buf, "hidden,", sizeof (buf)); if (ch & GRID_ATTR_ITALICS) strlcat(buf, "italics,", sizeof (buf)); - *(strrchr(buf, ',')) = '\0'; + if (*buf) + *(strrchr(buf, ',')) = '\0'; return (buf); } -- cgit v1.2.3