Skip to content

Commit

Permalink
fix: tmpGeometry format1
Browse files Browse the repository at this point in the history
  • Loading branch information
DuanKuanJun committed Jun 13, 2024
1 parent 5e2929a commit 6521354
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/benchData.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,12 @@ int tmpGeometry(char *tmp, int iface, Field *field, int64_t k) {
}

int32_t pos = snprintf(tmp, field->length, "LINESTRING(");
char * format = ",%d %d";
for(int32_t i = 0; i < cnt; i++) {
pos += snprintf(tmp + pos, field->length - pos, "%d %d", tmpUint16(field), tmpUint16(field));
if (i == 0) {
format = "%d %d";
}
pos += snprintf(tmp + pos, field->length - pos, format, tmpUint16(field), tmpUint16(field));

Check failure

Code scanning / CodeQL

Potentially overflowing call to snprintf High

The
size argument
of this snprintf call is derived from its return value, which may exceed the size of the buffer and overflow.
}
strcat(tmp, ")");

Expand Down

0 comments on commit 6521354

Please sign in to comment.