summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2010-06-30 10:52:05 -0600
committerRich Megginson <rmeggins@redhat.com>2010-07-01 15:50:08 -0600
commit4739bf587db66c9d8ceabd446dabbe03bc3a0664 (patch)
tree549aa8eda4d188561c92e338f6f57c46ba8b7368
parentfabd35294d0159ca840b019b6108df2eb759fea3 (diff)
downloadds-4739bf587db66c9d8ceabd446dabbe03bc3a0664.tar.gz
ds-4739bf587db66c9d8ceabd446dabbe03bc3a0664.tar.xz
ds-4739bf587db66c9d8ceabd446dabbe03bc3a0664.zip
Bug 609590 - fix coverity Defect Type: Memory - corruptions issues
https://bugzilla.redhat.com/show_bug.cgi?id=609590 Resolves: bug 609590 Bug Description: fix coverity Defect Type: Memory - corruptions issues Reviewed by: nhosoi (Thanks!) Branch: HEAD Fix Description: Just error and return if nread is < 0. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no
-rw-r--r--ldap/servers/slapd/tools/ldif.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ldap/servers/slapd/tools/ldif.c b/ldap/servers/slapd/tools/ldif.c
index 892b6ee2..e8e6f9bf 100644
--- a/ldap/servers/slapd/tools/ldif.c
+++ b/ldap/servers/slapd/tools/ldif.c
@@ -125,6 +125,10 @@ int main( int argc, char **argv )
max = BUFSIZ;
cur = 0;
while ( (nread = read( 0, buf, BUFSIZ )) != 0 ) {
+ if (nread < 0) {
+ perror( "read error" );
+ return( 1 );
+ }
if ( nread + cur > max ) {
max += BUFSIZ;
if (( val = (char *) realloc( val, max )) ==