Skip to content

Commit

Permalink
Avoid generating and parsing invalid JSON files (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
kattrali authored Dec 16, 2017
2 parents 5193dbb + 9b08b9c commit 292a227
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashState.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ bool bsg_kscrashstate_i_saveState(const BSG_KSCrash_State *const state,
goto done;
}
result = bsg_ksjsonendEncode(&JSONContext);

done:
if (!bsg_ksfuflushWriteBuffer(fd)) {
BSG_KSLOG_ERROR("Failed to flush write buffer");
}

done:
close(fd);

if (result != BSG_KSJSON_OK) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,9 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
}

if (!isFPChar(**ptr) && accum >= 0) {
if (name == NULL) {
return BSG_KSJSON_ERROR_INCOMPLETE;
}
accum *= sign;
return callbacks->onIntegerElement(name, accum, userData);
}
Expand Down

0 comments on commit 292a227

Please sign in to comment.