Skip to content

Commit

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

int32_t pos = snprintf(tmp, field->length, "LINESTRING(");
char * format = ",%d %d";
char * format = "%d %d,";
for(int32_t i = 0; i < cnt; i++) {
if (i == 0) {
if (i == cnt - 1) {
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 1310afc

Please sign in to comment.