diff options
author | Jeremy Allison <jra@samba.org> | 2006-08-28 03:15:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:55 -0500 |
commit | 28369f04b4974092e7fff6d33afeefe4e3a184e1 (patch) | |
tree | 8bc2b42e1bb930d662fcd7534535706b24e110cd /source3 | |
parent | 5f925a01908384fe9b49447677501e4f6aa3912e (diff) | |
download | samba-28369f04b4974092e7fff6d33afeefe4e3a184e1.tar.gz samba-28369f04b4974092e7fff6d33afeefe4e3a184e1.tar.bz2 samba-28369f04b4974092e7fff6d33afeefe4e3a184e1.zip |
r17869: More sensible fix for Stanford Checker null deref.
Jeremy.
(This used to be commit 2a73e82f9663fc0e14b4c2af94de3b4216f1eece)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/xfile.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c index 503e8c8359..8824ca2c3c 100644 --- a/source3/lib/xfile.c +++ b/source3/lib/xfile.c @@ -259,7 +259,7 @@ int x_fflush(XFILE *f) return -1; } - if (f->bufused == 0) return 0; + if (f->bufused == 0 || !f->buf) return 0; ret = write(f->fd, f->buf, f->bufused); if (ret == -1) return -1; @@ -267,9 +267,7 @@ int x_fflush(XFILE *f) f->bufused -= ret; if (f->bufused > 0) { f->flags |= X_FLAG_ERROR; - if (f->buf) { - memmove(f->buf, ret + (char *)f->buf, f->bufused); - } + memmove(f->buf, ret + (char *)f->buf, f->bufused); return -1; } |