psacct/psacct-6.6.1-SEGV-when-record-incomplete.patch

15 lines
567 B
Diff
Raw Normal View History

diff -Naur acct-6.6.1.orig/file_rd.c acct-6.6.1/file_rd.c
--- acct-6.6.1.orig/file_rd.c 2011-03-16 23:50:13.000000000 +0100
+++ acct-6.6.1/file_rd.c 2013-10-10 14:21:21.801097725 +0200
@@ -118,6 +118,10 @@
? max_recs
: fri->buffered_records);
+ /* Preventing SEGV when incomplete record appears */
+ if (recs_to_read==0)
+ goto no_more_records;
+
/* Move back in the file */
(void)fseek(fri->fp, -fri->record_size * recs_to_read,