diff options
author | Ray Lai <ray@openbsd.org> | 2009-06-02 11:14:08 +0000 |
---|---|---|
committer | Ray Lai <ray@openbsd.org> | 2009-06-02 11:14:08 +0000 |
commit | 3686645e775dafd7feb8452cc3e9d76445180237 (patch) | |
tree | d644cd107fd2a6a894e559a1cb7f588974e71cf6 | |
parent | df91860b522db207a04caeb95ccea16e2600afef (diff) | |
download | rtmux-3686645e775dafd7feb8452cc3e9d76445180237.tar.gz rtmux-3686645e775dafd7feb8452cc3e9d76445180237.tar.bz2 rtmux-3686645e775dafd7feb8452cc3e9d76445180237.zip |
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@
-rw-r--r-- | attributes.c | 3 |
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); } |