Skip to content

Commit

Permalink
Detect error condition in string formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
PengZheng authored Nov 18, 2023
1 parent 038808e commit 804d633
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/utils/src/properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static celix_status_t celix_properties_fillEntry(celix_properties_t* properties,
entry->valueType = CELIX_PROPERTIES_VALUE_TYPE_LONG;
entry->typed.longValue = prototype->typed.longValue;
int written = snprintf(convertedValueBuffer, sizeof(convertedValueBuffer), "%li", entry->typed.longValue);
if (written < 0 || written <= sizeof(convertedValueBuffer)) {
if (written >= 0 || written < sizeof(convertedValueBuffer)) {
entry->value = celix_properties_createString(properties, convertedValueBuffer);
} else {
//LCOV_EXCL_START
Expand Down

0 comments on commit 804d633

Please sign in to comment.