diff options
author | Martin Kiewitz | 2010-04-04 20:47:03 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-04-04 20:47:03 +0000 |
commit | 2e7b049e41eb02722d3daf518a8cfb83f95f8349 (patch) | |
tree | 69016d717f879770df2b226596686c425b5c6770 /engines/sci/engine/seg_manager.cpp | |
parent | f792c100a31434d8b50c78698c03d5dc072c870a (diff) | |
download | scummvm-rg350-2e7b049e41eb02722d3daf518a8cfb83f95f8349.tar.gz scummvm-rg350-2e7b049e41eb02722d3daf518a8cfb83f95f8349.tar.bz2 scummvm-rg350-2e7b049e41eb02722d3daf518a8cfb83f95f8349.zip |
SCI: check before writing 0 in SegManager::strncpy, fixes jones/cd crash
svn-id: r48519
Diffstat (limited to 'engines/sci/engine/seg_manager.cpp')
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index b02ed5083f..6a30d54ca4 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -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); } } |