1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Remove always-true condition, but be clear that n does not change in this function

This commit is contained in:
dmiller
2020-10-15 18:10:14 +00:00
parent 608d866fb7
commit 9faf70fc78

View File

@@ -489,7 +489,7 @@ void WriteSInfo(char *ostr, int ostrlen, bool isGoodFP,
No more than n bytes will be written. Unless n is 0, the string is always No more than n bytes will be written. Unless n is 0, the string is always
null-terminated. Returns the number of bytes written, excluding the null-terminated. Returns the number of bytes written, excluding the
terminator. */ terminator. */
static int test2str(const FingerTest *test, char *s, size_t n) { static int test2str(const FingerTest *test, char *s, const size_t n) {
std::vector<struct AVal>::const_iterator av; std::vector<struct AVal>::const_iterator av;
char *p; char *p;
char *end; char *end;
@@ -541,8 +541,7 @@ static int test2str(const FingerTest *test, char *s, size_t n) {
return p - s; return p - s;
error: error:
if (n > 0) *s = '\0';
*s = '\0';
return -1; return -1;
} }