diff options
author | toshii <toshii@pkgsrc.org> | 2004-02-29 03:45:37 +0000 |
---|---|---|
committer | toshii <toshii@pkgsrc.org> | 2004-02-29 03:45:37 +0000 |
commit | 99c404f7c3b268a7b4f0ac7abce9f7a914faee06 (patch) | |
tree | 4bb45e22561c80ee0d14d87d790c9e87673effcb /mail/clamav | |
parent | d6f353e14ecd49b42a41aa6b0f50d4c185664674 (diff) | |
download | pkgsrc-99c404f7c3b268a7b4f0ac7abce9f7a914faee06.tar.gz |
Fread(2)ing /dev/urandom is bad due to libc buffering.
Use read(2) instead.
Diffstat (limited to 'mail/clamav')
-rw-r--r-- | mail/clamav/distinfo | 3 | ||||
-rw-r--r-- | mail/clamav/patches/patch-ac | 35 |
2 files changed, 37 insertions, 1 deletions
diff --git a/mail/clamav/distinfo b/mail/clamav/distinfo index 738f34a6685..76b259ab664 100644 --- a/mail/clamav/distinfo +++ b/mail/clamav/distinfo @@ -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 --git a/mail/clamav/patches/patch-ac b/mail/clamav/patches/patch-ac new file mode 100644 index 00000000000..810ab8a6dfb --- /dev/null +++ b/mail/clamav/patches/patch-ac @@ -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 |