aboutsummaryrefslogtreecommitdiffstats
path: root/ui.c
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-02-05 19:04:33 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2012-02-05 19:04:33 +0000
commitf3410da7f0bd208a5f2d792131b215454e782e93 (patch)
tree6e79c9acde383b91f5f21eb3a72f33e9c7fbbfce /ui.c
parent03dfbc2efa31d3c4fd7e576111883ea488e3e179 (diff)
downloadwavemon-f3410da7f0bd208a5f2d792131b215454e782e93.tar.gz
Imported Upstream version 0.7.3upstream/0.7.3
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ui.c b/ui.c
index 979cb00..194f20d 100644
--- a/ui.c
+++ b/ui.c
@@ -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);