fanzju / google-glog

Automatically exported from code.google.com/p/google-glog
Other
0 stars 0 forks source link

Call to GetComputerNameA with uninilialized size parameter #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run a debug build of logging_unittest from within MSVC.

What is the expected output? What do you see instead?
The Output window shows multiple instances of the message
"HEAP[logging_unittest.exe]: Invalid allocation size - 99999998 (exceeded
7ffdefff)".

What version of the product are you using? On what operating system?
v0.2.1 on Windows XP x64

Please provide any additional information below.
I traced these messages back to a call to GetComputerNameA in logging.cc.
According to the MSDN docs the size parameter of this function is used to
determine the size of the buffer which is passed in. However currently the
size is being passed a pointer to an uninitialized DWORD "len". "len" needs
to be initialized to the size of the buffer being passed in, which, also
according to the MSDN docs, only needs to be "MAX_COMPUTERNAME_LENGTH + 1"
characters large.

This also fixes the hostname included in log file names, which otherwise is
always empty.

Original issue reported on code.google.com by mag...@gmail.com on 29 May 2009 at 6:21

GoogleCodeExporter commented 8 years ago
This should be fixed by http://code.google.com/p/google-glog/source/detail?r=62

Thanks for reporting this issue!

Original comment by shinichi...@gmail.com on 29 Jul 2009 at 7:42