From: noreply@... Date: 2005-10-07T04:42:03+09:00 Subject: [ ruby-Bugs-2594 ] [PATCH] memset not clearing memory due to reversed arguments Bugs item #2594, was opened at 2005-10-06 12:34 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2594&group_id=426 Category: Standard Library Group: None Status: Open Resolution: None Priority: 3 Submitted By: Blair Zajac (blairzajac) Assigned to: Nobody (None) Summary: [PATCH] memset not clearing memory due to reversed arguments Initial Comment: In ext/strscan/strscan.c memset() is being called with two of its arguments reversed, which is causing memset() not to do anything because the 0 meant to clear the pointed to memory is ending up in the argument on how many bytes to clear. This bug is still present in 1.8.3. --- ruby-1.8.2.orig/ext/strscan/strscan.c 2004-02-19 21:30:26.000000000 +0900 +++ ruby-1.8.2/ext/strscan/strscan.c 2005-03-22 19:31:24.000000000 +0900 @@ -176,7 +176,7 @@ struct strscanner *p; { re_free_registers(&(p->regs)); - memset(p, sizeof(struct strscanner), 0); + memset(p, 0, sizeof(struct strscanner)); free(p); } BTW, I found this patch in Fedora Core's latest RPM: http://download.fedora.redhat.com/pub/fedora/linux/core/development/SRPMS/ruby-1.8.3-4.src.rpm Regards, Blair ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2594&group_id=426