summaryrefslogtreecommitdiffstats
path: root/attributes.c
diff options
context:
space:
mode:
authorRay Lai <ray@openbsd.org>2009-06-02 11:14:08 +0000
committerRay Lai <ray@openbsd.org>2009-06-02 11:14:08 +0000
commit3686645e775dafd7feb8452cc3e9d76445180237 (patch)
treed644cd107fd2a6a894e559a1cb7f588974e71cf6 /attributes.c
parentdf91860b522db207a04caeb95ccea16e2600afef (diff)
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@
Diffstat (limited to 'attributes.c')
-rw-r--r--attributes.c3
1 files changed, 2 insertions, 1 deletions
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);
}