summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/attributes.c
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2009-06-02 11:14:09 +0000
committerRay Lai <ray@cvs.openbsd.org>2009-06-02 11:14:09 +0000
commit6496159955301f0475a2b3df0ea08e9d58a1535a (patch)
tree0cc9b0a92dff88b62a86f988af85c4c73c966cf3 /usr.bin/tmux/attributes.c
parent0797724f57c4b2cd3d9eca10af6ab148e857932a (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 'usr.bin/tmux/attributes.c')
-rw-r--r--usr.bin/tmux/attributes.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tmux/attributes.c b/usr.bin/tmux/attributes.c
index 7248b99f34a..8601d6e202b 100644
--- a/usr.bin/tmux/attributes.c
+++ b/usr.bin/tmux/attributes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: attributes.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */
+/* $OpenBSD: attributes.c,v 1.2 2009/06/02 11:14:08 ray Exp $ */
/*
* Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
@@ -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);
}