diff options
author | Sean Bright <sean@malleable.com> | 2009-01-13 23:46:00 +0000 |
---|---|---|
committer | Sean Bright <sean@malleable.com> | 2009-01-13 23:46:00 +0000 |
commit | 0ea1ba2d21e5730876609f6fd866194fc41a186c (patch) | |
tree | a163d8aadc5ba834f7beeabf2be596ae6fadead2 | |
parent | 0ca7f76c02f7f1669f4017de1039da3c3cad9b05 (diff) |
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
-rw-r--r-- | dahdi_monitor.c | 10 |
1 files changed, 5 insertions, 5 deletions
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); } |