mirror of
https://github.com/samba-team/samba.git
synced 2025-03-01 04:58:35 +03:00
Fix for client generated core-dump bug where offset to readraw
was so large that when used with -DUSE_MMAP it caused the unsigned subtraction to wrap aound and become positive - thus causing a silly memcpy offset. Thanks to "Michael St. Laurent" <rowl@earthlink.net> for giving me the core dump that allowed me to track this one down. Jeremy. (This used to be commit c9e066037ab222472085c4a0ecc8a39b337ad2aa)
This commit is contained in:
parent
6cd35ce945
commit
f52bb48748
@ -2058,7 +2058,8 @@ int read_file(int fnum,char *data,uint32 pos,int n)
|
|||||||
#if USE_MMAP
|
#if USE_MMAP
|
||||||
if (Files[fnum].mmap_ptr)
|
if (Files[fnum].mmap_ptr)
|
||||||
{
|
{
|
||||||
int num = MIN(n,(int)(Files[fnum].mmap_size-pos));
|
int num = (Files[fnum].mmap_size > pos) ? (Files[fnum].mmap_size - pos) : -1;
|
||||||
|
num = MIN(n,num);
|
||||||
if (num > 0)
|
if (num > 0)
|
||||||
{
|
{
|
||||||
memcpy(data,Files[fnum].mmap_ptr+pos,num);
|
memcpy(data,Files[fnum].mmap_ptr+pos,num);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user