summaryrefslogtreecommitdiff
path: root/read.c
AgeCommit message (Collapse)Author
2018-05-20Fix bulk and multi-bulk length truncationJustin Brewer
processMultiBulkItem truncates the value read from readLongLong, resulting in a corrupted state when the next item is read. createArray takes an int, so bound to INT_MAX. Inspection showed that processBulkItem had the same truncation issue. createString takes size_t, so bound to SIZE_MAX. This only has an effect on 32-bit platforms. A strict lower bound is also added, since negative lengths other than -1 are invalid according to RESP. Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-05-19Properly detect integer parse errorsJustin Brewer
Badly formatted or out-of-range integers are now protocol errors. Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-30Remove redundant NULL checksJustin Brewer
free(NULL) is a valid NOP. Most of the hiredis free functions behave the same way. redisReaderFree is updated to also be NULL-safe. There is one redundant NULL check at sds.c:1036, but it's left as is since sds is imported from upstream. Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-30Remove redundant zero storesJustin Brewer
calloc is guaranteed to provide a zero-initialized buffer. There is no need to set fields to zero explicitly. Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-01-05calloc param fixes and NULL checkcdliuqiang@gmail.com
2016-04-11Update read.cDongwenHuang
static char *seekNewline(char *s, size_t len) : this function can not parse the string,such as "hello world\r". the case that the last char is '\r'.
2015-03-13Added support for compiling the parser code with Microsoft Visual C compiler.tzickel
For hiredis-py and others support on windows.
2015-01-05Refactor reading code into read.ctzickel
Makes hiredis reading functions easier to include in external projects [fixed all merge conflicts against current version] Closes #249