From 841dd859360ff07d705e869d2a402f6b181a14f9 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sun, 1 Sep 2013 09:47:18 +0000 Subject: [PATCH 1/3] fix buffer overflow on interrupted read (thanks John Sullivan) (07a8170 from 0.9) git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-0.8@2029 ef36b2f9-881f-0410-afb5-c4e39611909c --- AUTHORS | 1 + common/tio.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 5debe5f7c2a059e67f47098df8647c66eab85c13..65ee0789cb8c300c59f7b00b75e80b5b51d96ac9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -119,3 +119,4 @@ Maxim Vetrov Matthew L. Dailey Chris Hiestand Jon Severinsson +John Sullivan diff --git a/common/tio.c b/common/tio.c index 4456198fe84ea72966edb06700c0fff751dd3451..9aef80ca91faedad8f75e09b9070d22ed4a0878d 100644 --- a/common/tio.c +++ b/common/tio.c @@ -283,8 +283,8 @@ int tio_read(TFILE *fp, void *buf, size_t count) } else if ((rv<0)&&(errno!=EINTR)&&(errno!=EAGAIN)) return -1; /* something went wrong with the read */ - /* skip the read part in the buffer */ - fp->readbuffer.len=rv; + else if (rv>0) + fp->readbuffer.len=rv; /* skip the read part in the buffer */ #ifdef DEBUG_TIO_STATS fp->bytesread+=rv; #endif /* DEBUG_TIO_STATS */ -- 1.8.3.1