pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mail/clamav Fread(2)ing /dev/urandom is bad due to lib...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/366d894a9f59
branches:  trunk
changeset: 469797:366d894a9f59
user:      toshii <toshii%pkgsrc.org@localhost>
date:      Sun Feb 29 03:45:37 2004 +0000

description:
Fread(2)ing /dev/urandom is bad due to libc buffering.
Use read(2) instead.

diffstat:

 mail/clamav/distinfo         |   3 ++-
 mail/clamav/patches/patch-ac |  35 +++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletions(-)

diffs (52 lines):

diff -r e2a91b2cbd7f -r 366d894a9f59 mail/clamav/distinfo
--- a/mail/clamav/distinfo      Sun Feb 29 03:33:06 2004 +0000
+++ b/mail/clamav/distinfo      Sun Feb 29 03:45:37 2004 +0000
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.7 2004/02/11 10:55:49 recht Exp $
+$NetBSD: distinfo,v 1.8 2004/02/29 03:46:22 toshii Exp $
 
 SHA1 (clamav-0.66.tar.gz) = 1a008d33f8e2caf54708b952747e5a5266610cfc
 Size (clamav-0.66.tar.gz) = 2275692 bytes
 SHA1 (patch-aa) = 779aef1a73f78749e1e6b9ed5e5fd6eb0d537a41
 SHA1 (patch-ab) = 49f80b512704fec57c6b920d2625c083c756f957
+SHA1 (patch-ac) = cab02632217fe4d75c0b48d0fd962d7822c3617d
 SHA1 (patch-ad) = 6f2bfa05bb3421280272719c03260784a7826e91
diff -r e2a91b2cbd7f -r 366d894a9f59 mail/clamav/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/clamav/patches/patch-ac      Sun Feb 29 03:45:37 2004 +0000
@@ -0,0 +1,35 @@
+$NetBSD: patch-ac,v 1.3 2004/02/29 03:45:37 toshii Exp $
+
+--- libclamav/others.c.orig    Wed Feb 11 08:03:01 2004
++++ libclamav/others.c
+@@ -261,13 +261,13 @@
+ 
+ unsigned int cl_rndnum(unsigned int max)
+ {
+-      FILE *fd;
++      int fd;
+       unsigned int generated;
+       char *byte;
+       int size;
+ 
+ 
+-    if((fd = fopen("/dev/urandom", "rb")) == NULL) {
++    if((fd = open("/dev/urandom", O_RDONLY)) < 0) {
+       cli_errmsg("!Can't open /dev/urandom.\n");
+       return -1;
+     }
+@@ -276,12 +276,12 @@
+     size = sizeof(generated);
+     do {
+       int bread;
+-      bread = fread(byte, 1, size, fd);
++      bread = read(fd, byte, size);
+       size -= bread;
+       byte += bread;
+     } while(size > 0);
+ 
+-    fclose(fd);
++    close(fd);
+     return generated % max;
+ }
+ #endif



Home | Main Index | Thread Index | Old Index