SCI: check before writing 0 in SegManager::strncpy, fixes jones/cd crash
svn-id: r48519
This commit is contained in:
parent
f792c100a3
commit
2e7b049e41
1 changed files with 3 additions and 1 deletions
|
@ -635,6 +635,7 @@ void SegManager::strncpy(reg_t dest, const char* src, size_t n) {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if (dest_r.isRaw) {
|
||||
// raw -> raw
|
||||
if (n == 0xFFFFFFFFU)
|
||||
|
@ -649,7 +650,8 @@ void SegManager::strncpy(reg_t dest, const char* src, size_t n) {
|
|||
break;
|
||||
}
|
||||
// Put an ending NUL to terminate the string
|
||||
setChar(dest_r, n, 0);
|
||||
if ((size_t)dest_r.maxSize > n)
|
||||
setChar(dest_r, n, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue