Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prv_parseItem() in json.c use string as a boolean #499

Closed
stefanfangvall opened this issue Nov 23, 2020 · 0 comments · Fixed by #543
Closed

prv_parseItem() in json.c use string as a boolean #499

stefanfangvall opened this issue Nov 23, 2020 · 0 comments · Fixed by #543

Comments

@stefanfangvall
Copy link

stefanfangvall commented Nov 23, 2020

string is no boolean, do not use negation

static int prv_parseItem(const uint8_t * buffer,
size_t bufferLen,
_record_t * recordP)
{
.
.

case _TYPE_STRING:
if (0 != recordP->valueLen)
{
size_t stringLen;
uint8_t *string = (uint8_t *)lwm2m_malloc(recordP->valueLen);
if (!string) return false;
stringLen = json_unescapeString(string, recordP->value, recordP->valueLen);
if (stringLen)
{
lwm2m_data_encode_nstring((char *)string, stringLen, targetP);
lwm2m_free(string);
}

qleisan pushed a commit to qleisan/wakaama that referenced this issue Feb 22, 2021
Make explicit comparison with NULL to address reported issue eclipse-wakaama#499. Not a bug
qleisan pushed a commit to qleisan/wakaama that referenced this issue Feb 22, 2021
Make explicit comparison with NULL to address reported issue eclipse-wakaama#499. Not a bug.

Signed-off-by: Leif Sandstrom <leif.sandstrom@husqvarnagroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants