aboutsummaryrefslogtreecommitdiffstats
path: root/ui.c
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-02-05 19:06:21 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2012-02-05 19:06:21 +0000
commit4aa11b915e718d739d7bbfc737b77164d79af116 (patch)
tree4cd88e5cca9df66f069a2eb1b639ec0ad938948c /ui.c
parentc93ad1a4ef2625ffb849b8868fe32f930594ac70 (diff)
parentf3410da7f0bd208a5f2d792131b215454e782e93 (diff)
downloadwavemon-4aa11b915e718d739d7bbfc737b77164d79af116.tar.gz
Resolve 0.7.3 import conflict
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);