jvm-profiling-tools / honest-profiler

A sampling JVM profiler without the safepoint sample bias
https://github.com/RichardWarburton/honest-profiler/wiki
MIT License
1.25k stars 146 forks source link

Possible SEGV in Controller::reportStatus? #136

Open tm2git opened 8 years ago

tm2git commented 8 years ago

I haven't actually seen this happen, just noticed it in the source code:

The "logPath" option may be set but doesn't have to be.

If it isn't set then ConfigurationOptions.logFilePath is NULL. The code in Profiler checks for this and helpfully generates a sensible default filename, which it then uses (but doesn't store to ConfigurationOptions.logFilePath).

Controller::reportStatus passes ConfigurationOptions.logFilePath to strlen() without checking whether it's NULL. If you happen to have a friendly strlen() implementation that recognizes NULL and returns 0 then you're probably OK, otherwise I'd expect this to SEGV.