1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

fix for 0 length modifier value

This commit is contained in:
tg(x) 2011-05-04 18:58:46 +02:00
parent 220481d954
commit fea30e3688

View file

@ -104,8 +104,8 @@ psycParseRC psyc_parseBinaryValue (psycParseState *state, psycString *value,
size_t remaining = *length - *parsed; size_t remaining = *length - *parsed;
value->ptr = state->buffer.ptr + state->cursor; value->ptr = state->buffer.ptr + state->cursor;
if (state->cursor + remaining > state->buffer.length) // is the length larger than this buffer? if (state->cursor + remaining > state->buffer.length)
{ { // value doesn't fit in the buffer completely
value->length = state->buffer.length - state->cursor; value->length = state->buffer.length - state->cursor;
state->cursor += value->length; state->cursor += value->length;
*parsed += value->length; *parsed += value->length;
@ -168,7 +168,7 @@ psycParseRC psyc_parseModifier (psycParseState *state, char *oper,
return PSYC_PARSE_ERROR_MOD_TAB; return PSYC_PARSE_ERROR_MOD_TAB;
if (++(state->cursor) >= state->buffer.length) if (++(state->cursor) >= state->buffer.length)
return PSYC_PARSE_INCOMPLETE; return length ? PSYC_PARSE_INCOMPLETE : PSYC_PARSE_SUCCESS; // if length=0 we're done
ret = psyc_parseBinaryValue(state, value, &(state->valueLength), &(state->valueParsed)); ret = psyc_parseBinaryValue(state, value, &(state->valueLength), &(state->valueParsed));
if (ret == PSYC_PARSE_INCOMPLETE) if (ret == PSYC_PARSE_INCOMPLETE)