mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 03:50:57 +01:00
check for zero sized input
This commit is contained in:
11
libpcp/z85.c
11
libpcp/z85.c
@@ -183,8 +183,17 @@ size_t pcp_unpadfour(byte *src, size_t srclen) {
|
|||||||
byte *pcp_z85_decode(char *z85block, size_t *dstlen) {
|
byte *pcp_z85_decode(char *z85block, size_t *dstlen) {
|
||||||
byte *bin = NULL;
|
byte *bin = NULL;
|
||||||
size_t binlen, outlen;
|
size_t binlen, outlen;
|
||||||
|
size_t srclen;
|
||||||
|
|
||||||
|
srclen = strlen(z85block);
|
||||||
|
|
||||||
binlen = strlen(z85block) * 4 / 5;
|
if(srclen == 0) {
|
||||||
|
/* FIXME: check how this happens, pcpstream decoder call */
|
||||||
|
*dstlen = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
binlen = srclen * 4 / 5;
|
||||||
bin = ucmalloc(binlen);
|
bin = ucmalloc(binlen);
|
||||||
|
|
||||||
if(zmq_z85_decode(bin, z85block) == NULL) {
|
if(zmq_z85_decode(bin, z85block) == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user