SETranslatingPortProxy: fix bug in tryReadString()
Off-by-one loop termination meant that we were stuffing the terminating '\0' into the std::string value, which makes for difficult-to-debug string comparison failures.
This commit is contained in:
parent
73ef8bd168
commit
f4b424cd53
|
@ -190,15 +190,18 @@ SETranslatingPortProxy::tryReadString(std::string &str, Addr addr) const
|
|||
|
||||
Addr vaddr = addr;
|
||||
|
||||
do {
|
||||
while (true) {
|
||||
Addr paddr;
|
||||
|
||||
if (!pTable->translate(vaddr++, paddr))
|
||||
return false;
|
||||
|
||||
PortProxy::readBlob(paddr, &c, 1);
|
||||
if (c == '\0')
|
||||
break;
|
||||
|
||||
str += c;
|
||||
} while (c);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue