From: Seven Du Date: Sat, 6 Sep 2014 10:29:19 +0000 (+0800) Subject: fix return value X-Git-Tag: v1.4.8~2^2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa15994c7f4dc447fe7ca2a60ca32b99e7036e47;p=thirdparty%2Ffreeswitch.git fix return value --- diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 2702862027..16179cfb8a 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -542,8 +542,10 @@ SWITCH_DECLARE(const char *) Stream::read(int *len) buff = stream_p->read_function(stream_p, len); - if (!buff) return NULL; - if (len < 0) return NULL; + if (!buff || *len <= 0) { + *len = 0; + return NULL; + } return (const char *)buff; }