ancruna / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

assert() call out of place #304

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. View mongoose.c line 3999
2. See that assert(conn) is called after conn has been dereferenced twice.
3. Realize the NULL pointer dereference wasn't protected against by the 
assert().

What is the expected output? What do you see instead?
The code just has a simple bug.

What version of the product are you using? On what operating system?
Latest version of mongoose.c  544f09214e83

Please provide any additional information below.

The fix is to move the assert(conn != NULL) check to right after conn is 
allocated (two lines earlier).

Original issue reported on code.google.com by scott.wi...@gmail.com on 24 Dec 2011 at 4:35

GoogleCodeExporter commented 9 years ago
Submitted 
http://code.google.com/p/mongoose/source/detail?r=4c078b4a8df9b74675b1404c2c5d65
06cb54c45b
Thanks!

Original comment by valenok on 11 Mar 2012 at 10:26