Blame SOURCES/nss-pam-ldapd-0.8.12-fix-buffer-overflow-on-interrupted-read-thanks-John-.patch

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