pip010 / sparsehash

Automatically exported from code.google.com/p/sparsehash
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

windows/port.cc:TmpFile returns a pointer to a local varaible #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We found this bug with a static analysis tool.  It's an easy fix.  Line 55
of src/windows/port.cc has: 

char tmppath_buffer[1024];

line 62 has:

return tmppath_buffer;

oops.  

What version of the product are you using? On what operating system?

I found this in version 1.3, but it's still there in 1.5.2.

Original issue reported on code.google.com by jrl...@gmail.com on 7 Oct 2009 at 9:15

GoogleCodeExporter commented 9 years ago
This is actually fine -- the function returns a string, not a pointer, so the 
local
buffer is converted to a string before being returned.

I'm closing this as NotABug.  Though maybe it's a good bug to file with the 
static
analysis tool? :-)

Original comment by csilv...@gmail.com on 12 Oct 2009 at 12:18