1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-16 20:59:02 +00:00

Fix a bug in --script-trace hex dump output resulting in bytes with highest bit set to be prefixed by ffffff.

This commit is contained in:
sven
2008-09-03 22:09:15 +00:00
parent f3e1777d95
commit 801e537697
2 changed files with 5 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
# Nmap Changelog ($Id$); -*-text-*- # Nmap Changelog ($Id$); -*-text-*-
o Fix a bug in --script-trace hex dump output resulting in bytes with
highest bit set to be prefixed by ffffff. [Sven Klemm]
o Updated rpcinfo NSE script to use the new pack/unpack (binlib) o Updated rpcinfo NSE script to use the new pack/unpack (binlib)
functions, use the new tab library, include better documentation, and functions, use the new tab library, include better documentation, and
fix some bugs. [Sven Klemm] fix some bugs. [Sven Klemm]

View File

@@ -87,7 +87,7 @@ static std::string hexify (const char *str, size_t len)
if (isprint(str[i]) || isspace(str[i])) if (isprint(str[i]) || isspace(str[i]))
ret << str[i]; ret << str[i];
else else
ret << std::setw(3) << "\\" << (unsigned int) str[i]; ret << std::setw(3) << "\\" << (unsigned int)(unsigned char) str[i];
} }
return ret.str(); return ret.str();
} }
@@ -98,7 +98,7 @@ static std::string hexify (const char *str, size_t len)
ret << std::setw(8) << i << ": "; ret << std::setw(8) << i << ": ";
for (size_t j = i; j < i + 16; j++) for (size_t j = i; j < i + 16; j++)
if (j < len) if (j < len)
ret << std::setw(2) << (unsigned int) str[j] << " "; ret << std::setw(2) << (unsigned int)(unsigned char) str[j] << " ";
else else
ret << " "; ret << " ";
for (size_t j = i; j < i + 16 && j < len; j++) for (size_t j = i; j < i + 16 && j < len; j++)