Skip to content

LGTM.com - false positive in [cpp/constant-comparison] #4249

@dmiller-nmap

Description

@dmiller-nmap

Description of the false positive

Description states "Comparison is always false because n >= 0" but n is returned from Snprintf, which gets it from Vsnprintf(), which gets it from vsnprintf() which may return a negative number in the case of an error (C++ stdio, GlibC, and MSDN docs confirm). Why does LGTM think n must be positive?

URL to the alert on the project page on LGTM.com

https://lgtm.com/projects/g/nmap/nmap/snapshot/e608b14363bf4270b11a15f043b553f1599ea5e1/files/ncat/ncat_listen.c?sort=name&dir=ASC&mode=heatmap#xe60cc1a8fde0e6f6:1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions