Skip to content

Commit 45bea3d

Browse files
committed
CDRIVER-5912 fix bounds-strict sanitizer (#1887)
Remove size from flexible array member declaration of `jsonsl_st::stack`
1 parent 1daf272 commit 45bea3d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libbson/src/jsonsl/jsonsl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jsonsl_t jsonsl_new(int nlevels)
111111

112112
jsn = (struct jsonsl_st *)
113113
bson_malloc0(sizeof (*jsn) +
114-
( (nlevels-1) * sizeof (struct jsonsl_state_st) )
114+
( (nlevels) * sizeof (struct jsonsl_state_st) )
115115
);
116116

117117
jsn->levels_max = (unsigned int) nlevels;

src/libbson/src/jsonsl/jsonsl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ struct jsonsl_st {
568568
* nlevels argument passed to jsonsl_new. If you modify this structure,
569569
* make sure that this member is last.
570570
*/
571-
struct jsonsl_state_st stack[1];
571+
struct jsonsl_state_st stack[];
572572
};
573573

574574

0 commit comments

Comments
 (0)