mirror of
https://github.com/nmap/nmap.git
synced 2026-08-28 04:25:15 +00:00
Fix off-by-one error: need 1 more byte for null terminator
This commit is contained in:
parent
631d163fb2
commit
91df781351
1 changed files with 2 additions and 2 deletions
|
|
@ -113,7 +113,7 @@ const char *CharPool::dup(const char *src, int len) {
|
|||
if ((modulus = sz % ALIGN_ON))
|
||||
sz += ALIGN_ON - modulus;
|
||||
|
||||
while (nexti + sz > currentbucketsz) {
|
||||
while (nexti + sz > currentbucketsz - 1) {
|
||||
/* Doh! We've got to make room */
|
||||
currentbucketsz <<= 1;
|
||||
nexti = 0;
|
||||
|
|
@ -121,7 +121,7 @@ const char *CharPool::dup(const char *src, int len) {
|
|||
buckets.push_back(p);
|
||||
}
|
||||
|
||||
nexti += sz;
|
||||
nexti += sz + 1;
|
||||
p[sz] = '\0';
|
||||
return (const char *) memcpy(p, src, sz);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue