nss-pam-ldapd commit: r1689 - in nss-pam-ldapd-0.7: . common
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1689 - in nss-pam-ldapd-0.7: . common
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1689 - in nss-pam-ldapd-0.7: . common
- Date: Fri, 11 May 2012 12:51:42 +0200 (CEST)
Author: arthur
Date: Fri May 11 12:51:42 2012
New Revision: 1689
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1689&view=revision
Log:
ensure that we don't try to read more than SSIZE_MAX bytes (r1636 from 0.8
branch)
Modified:
nss-pam-ldapd-0.7/ (props changed)
nss-pam-ldapd-0.7/common/tio.c
Modified: nss-pam-ldapd-0.7/common/tio.c
==============================================================================
--- nss-pam-ldapd-0.7/common/tio.c Fri May 11 11:28:29 2012 (r1688)
+++ nss-pam-ldapd-0.7/common/tio.c Fri May 11 12:51:42 2012 (r1689)
@@ -2,7 +2,7 @@
tio.c - timed io functions
This file is part of the nss-pam-ldapd library.
- Copyright (C) 2007, 2008 Arthur de Jong
+ Copyright (C) 2007, 2008, 2010, 2011, 2012 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -34,6 +34,7 @@
#include <string.h>
#include <signal.h>
#include <stdio.h>
+#include <limits.h>
#include "tio.h"
@@ -229,6 +230,7 @@
int rv;
uint8_t *tmp;
size_t newsz;
+ size_t len;
/* have a more convenient storage type for the buffer */
uint8_t *ptr=(uint8_t *)buf;
/* build a time by which we should be finished */
@@ -293,7 +295,12 @@
if (tio_select(fp,1,&deadline))
return -1;
/* read the input in the buffer */
-
rv=read(fp->fd,fp->readbuffer.buffer+fp->readbuffer.start,fp->readbuffer.size-fp->readbuffer.start);
+ len=fp->readbuffer.size-fp->readbuffer.start;
+#ifdef SSIZE_MAX
+ if (len>SSIZE_MAX)
+ len=SSIZE_MAX;
+#endif /* SSIZE_MAX */
+ rv=read(fp->fd,fp->readbuffer.buffer+fp->readbuffer.start,len);
/* check for errors */
if ((rv==0)||((rv<0)&&(errno!=EINTR)&&(errno!=EAGAIN)))
return -1; /* something went wrong with the read */
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/
- nss-pam-ldapd commit: r1689 - in nss-pam-ldapd-0.7: . common,
Commits of the nss-pam-ldapd project