ソースを参照

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
Rich Megginson 15 年 前
コミット
4739bf587d
1 ファイル変更4 行追加0 行削除
  1. 4 0
      ldap/servers/slapd/tools/ldif.c

+ 4 - 0
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 )) ==