Fixed nasty segmentation fault bug on membuffer.c.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@142 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2007-03-03 15:01:59 +00:00
parent c3060e0d0b
commit 88076a3c4b
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,11 @@
*************************************************************************
Version 1.4.3
*************************************************************************
2007-03-03 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Fixed nasty segmentation fault bug on membuffer.c.
*************************************************************************
Version 1.4.2
*************************************************************************

View File

@ -331,9 +331,10 @@ membuffer_assign( INOUT membuffer * m,
return return_code;
}
// copy
memcpy( m->buf, buf, buf_len );
m->buf[buf_len] = 0; // null-terminate
if( buf_len ) {
memcpy( m->buf, buf, buf_len );
m->buf[buf_len] = 0; // null-terminate
}
m->length = buf_len;
return 0;