Summary: | ASTERISK-04484: [patch] wrong argument to ast_copy_string | ||
Reporter: | Luigi Rizzo (rizzo) | Labels: | |
Date Opened: | 2005-06-26 07:16:21 | Date Closed: | 2008-01-15 15:40:44.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | a couple of instances of ast_copy_string have an off-by-one third argument, as spotted by the following grep: removing the -1 is trivial so i am not including a patch :) > grep -rn ast_copy_string * | grep -- -1 apps/app_queue.c:1935: ast_copy_string(tmp->interface, cur->interface, sizeof(tmp->interface)-1); channels/chan_sip.c:6365: ast_copy_string(p->language, peer->language, sizeof(p->language) -1); ****** ADDITIONAL INFORMATION ****** I still think that a #define AST_S_COPY(dst, src) ast_copy_string(dst, src, sizeof(dst)) would prevent clerical errors like this from occurring, make code shorter and more readable, and also give a chance to put, additional checks in the macro so we could spot at compile time cases where the first argument is a pointer and not an array. With 700+ instances of ast_copy_string() around, that's not unlikely. | ||
Comments: | By: Russell Bryant (russell) 2005-07-11 16:58:54 fixed in CVS HEAD, thanks! By: Digium Subversion (svnbot) 2008-01-15 15:40:44.000-0600 Repository: asterisk Revision: 6084 U trunk/apps/app_queue.c U trunk/channels/chan_sip.c ------------------------------------------------------------------------ r6084 | russell | 2008-01-15 15:40:43 -0600 (Tue, 15 Jan 2008) | 2 lines fix off by one errors in calls to ast_copy_string (bug ASTERISK-4484) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=6084 |