From 0ea1ba2d21e5730876609f6fd866194fc41a186c Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Tue, 13 Jan 2009 23:46:00 +0000 Subject: The problem with using dahdi_copy_string here is that it is guaranteed to NULL terminate the destination string, which in this case was not correct. So revert back to using strncpy and also decrease the buffer by 1 since it was reserving an extra byte behind NULL for some reason. Fix suggested by reporter. (closes issue #14103) Reported by: gork git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@5656 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- dahdi_monitor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'dahdi_monitor.c') diff --git a/dahdi_monitor.c b/dahdi_monitor.c index a328daa..3d7f14c 100644 --- a/dahdi_monitor.c +++ b/dahdi_monitor.c @@ -155,17 +155,17 @@ int pseudo_open(void) void draw_barheader() { - char bar[barlen+5]; + char bar[barlen + 4]; memset(bar, '-', sizeof(bar)); memset(bar, '<', 1); - memset(bar+barlen+2, '>', 1); - memset(bar+barlen+3, '\0', 1); + memset(bar + barlen + 2, '>', 1); + memset(bar + barlen + 3, '\0', 1); - dahdi_copy_string(bar+(barlen/2), "(RX)", 4); + strncpy(bar + (barlen / 2), "(RX)", 4); printf("%s", bar); - dahdi_copy_string(bar+(barlen/2), "(TX)", 4); + strncpy(bar + (barlen / 2), "(TX)", 4); printf(" %s\n", bar); } -- cgit v1.2.3