[Asterisk-Dev] Re: trunk - r7863 /trunk/apps/app_voicemail.c
Tony Mountifield
tony at softins.clara.co.uk
Sun Jan 8 09:56:00 MST 2006
In article <20060107234324.B1BD9A9499A at abita.digium.internal>,
<svn-commits at lists.digium.com> wrote:
> Author: markster
> Date: Sat Jan 7 17:43:23 2006
> New Revision: 7863
>
> URL: http://svn.digium.com/view/asterisk?rev=7863&view=rev
> Log:
> Fix segfault in greek syntax (bug #6142)
>
> Modified:
> trunk/apps/app_voicemail.c
>
> Modified: trunk/apps/app_voicemail.c
> URL:
> http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=7863&r1=7862&r2=7863&view=diff
> ==============================================================================
> --- trunk/apps/app_voicemail.c (original)
> +++ trunk/apps/app_voicemail.c Sat Jan 7 17:43:23 2006
> @@ -3898,8 +3898,8 @@
> static int vm_play_folder_name_gr(struct ast_channel *chan, char *mbox)
> {
> int cmd;
> - char buf[sizeof(mbox)+1];
> -
> + char *buf;
> + buf = alloca(strlen(mbox)+2);
> memset(buf, '\0', sizeof(char)*(sizeof(buf)));
> strcpy(buf, mbox);
> strcat(buf,"s");
The memset should also be removed. Firstly, it will overflow if
strlen(mbox) is less than 2, and secondly, since the buffer is now
exactly the right size, it will be completely filled by the strcpy()
and strcat().
Cheers
Tony
--
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org
More information about the asterisk-dev
mailing list