diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-02-05 19:04:33 +0000 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-02-05 19:04:33 +0000 |
commit | f3410da7f0bd208a5f2d792131b215454e782e93 (patch) | |
tree | 6e79c9acde383b91f5f21eb3a72f33e9c7fbbfce /ui.c | |
parent | 03dfbc2efa31d3c4fd7e576111883ea488e3e179 (diff) | |
download | wavemon-f3410da7f0bd208a5f2d792131b215454e782e93.tar.gz |
Imported Upstream version 0.7.3upstream/0.7.3
Diffstat (limited to '')
-rw-r--r-- | ui.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -84,12 +84,16 @@ const char *curtail(const char *str, const char *sep, int len) const char fallback_sep[] = "~"; int l = 0, front, mid, back; - assert(len < sizeof(out_buf)); + if (len >= sizeof(out_buf)) + len = sizeof(out_buf) - 1; - if (sep == NULL) + if (sep == NULL || *sep == '\0') sep = fallback_sep; mid = strlen(sep); - assert(len >= mid); + if (mid > len) { + sep = fallback_sep; + mid = strlen(sep); + } if (str != NULL) l = strlen(str); |