Skip to content

Commit 99043b3

Browse files
committed
Fixed bug #3139678: stack buffer overflow when parsing a double with a length of 32 characters.
1 parent 9c98f22 commit 99043b3

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

NEWS.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
* Compilation
55

6-
- LD_LIBRARY_PATH and LIBRARY_PATH environment variables are now propagated to the build
7-
environment as this is required for some compiler installation.
6+
- LD_LIBRARY_PATH and LIBRARY_PATH environment variables are now
7+
propagated to the build environment as this is required for some
8+
compiler installation.
89

910
- Added support for Microsoft Visual Studio 2008 (bug #2930462):
1011
The platform "msvc90" has been added.
@@ -70,8 +71,11 @@
7071

7172
* Bug fixes
7273

73-
- Bug #3139677: JSON [1 2 3] was incorrectly parsed as [1, 3]. Error is now correctly
74-
detected.
74+
- Bug #3139677: JSON [1 2 3] was incorrectly parsed as [1, 3]. Error is now
75+
correctly detected.
76+
77+
- Bug #3139678: stack buffer overflow when parsing a double with a
78+
length of 32 characters.
7579

7680
* License
7781

src/lib_json/json_reader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ Reader::decodeDouble( Token &token )
610610
int length = int(token.end_ - token.start_);
611611
if ( length <= bufferSize )
612612
{
613-
Char buffer[bufferSize];
613+
Char buffer[bufferSize+1];
614614
memcpy( buffer, token.start_, length );
615615
buffer[length] = 0;
616616
count = sscanf( buffer, "%lf", &value );

0 commit comments

Comments
 (0)