Mercurial > dropbear
diff buffer.c @ 1046:b8f4b7027191 coverity
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 24 Feb 2015 22:48:34 +0800 |
parents | a5b785c12340 |
children | 16584026a1f0 |
line wrap: on
line diff
--- a/buffer.c Tue Feb 10 21:47:43 2015 +0800 +++ b/buffer.c Tue Feb 24 22:48:34 2015 +0800 @@ -99,7 +99,9 @@ ret = buf_new(buf->len); ret->len = buf->len; - memcpy(ret->data, buf->data, buf->len); + if (buf->len > 0) { + memcpy(ret->data, buf->data, buf->len); + } return ret; } @@ -127,7 +129,7 @@ buf->pos = pos; } -/* increment the postion by incr, increasing the buffer length if required */ +/* increment the position by incr, increasing the buffer length if required */ void buf_incrwritepos(buffer* buf, unsigned int incr) { if (incr > BUF_MAX_INCR || buf->pos + incr > buf->size) { dropbear_exit("Bad buf_incrwritepos");