Summary: | DAHTOOL-00011: dahdi_monitor audio level meters are cut off halfway | ||
Reporter: | John Laur (gork) | Labels: | |
Date Opened: | 2008-12-17 17:54:08.000-0600 | Date Closed: | 2009-01-13 17:46:02.000-0600 |
Priority: | Trivial | Regression? | No |
Status: | Closed/Complete | Components: | General |
Versions: | 2.1.0 | Frequency of Occurrence | |
Related Issues: | |||
Environment: | Attachments: | ||
Description: | In the current dahdi-tools packages, the audio level meters are cut off due to the way the string is built up in draw_barheader(). They look like this: <----------------(RX <----------------(TX When they should look like this: <----------------(RX)----------------> <----------------(TX)----------------> ****** ADDITIONAL INFORMATION ****** The reason for this is that the function dahdi_copy_string which has replaced all usage of strncpy in this code always adds a null terminator. In this case, the (RX) and (TX) labels are added in after the rest of the string is built and the additional null byte in the middle of the string kills the printf early. The simple fix of just going back to strncpy is safe in this particular circumstance, but I'll leave it to the powers that be on what to do. I imagine the existence of dahdi_copy_string is an indication that there is some kind of policy against strncpy at work here. I thought it would be appropriate to file this simple problem as a very elaborate bug report since draw_barheader is so ridiculously overcomplicated for what it does anyway. | ||
Comments: | By: Digium Subversion (svnbot) 2009-01-13 17:46:01.000-0600 Repository: dahdi Revision: 5656 U tools/trunk/dahdi_monitor.c ------------------------------------------------------------------------ r5656 | seanbright | 2009-01-13 17:46:01 -0600 (Tue, 13 Jan 2009) | 8 lines 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 DAHTOOL-11) Reported by: gork ------------------------------------------------------------------------ http://svn.digium.com/view/dahdi?view=rev&revision=5656 |