[Pkg-tcltk-devel] Bug#440682: Bug#440682: tcl8.4 has buggy memcmp.c
miguel sofer
miguel.sofer at gmail.com
Mon Sep 3 16:50:43 UTC 2007
See Tcl bug #1786647
(https://sourceforge.net/tracker/index.php?func=detail&aid=1786647&group_id=10894&atid=110894)
Ian Jackson wrote:
> Package: tcl8.4
> Version: 8.4.15-1
> Severity: important
> Tags: patch
>
> Seeing this warning
> /work/AutomatedTesting-packages/build/tcl8.4-8.4.15/unix/../compat/memcmp.c:55: warning: dereferencing 'void *' pointer
>
> I went to look at the file memcmp.c and found a buggy implementation
> of memcmp! It will always return 0 if the first two bytes are the
> same.
>
> The patch below should be applied immediately and probably sent
> upstream too.
>
> I don't know why it's building the compat/memcmp.c when we have a
> perfectly good memcmp.
>
> Regards,
> Ian.
>
> --- tcl8.4-8.4.15/compat/memcmp.c~ 2007-01-22 23:27:53.000000000 +0000
> +++ tcl8.4-8.4.15/compat/memcmp.c 2007-09-03 17:20:53.000000000 +0100
> @@ -43,16 +43,16 @@
> */
>
> int
> -memcmp(s1, s2, n)
> - CONST VOID *s1; /* First string. */
> - CONST VOID *s2; /* Second string. */
> +memcmp(s1_arg, s2_arg, n)
> + CONST VOID *s1_arg; /* First string. */
> + CONST VOID *s2_arg; /* Second string. */
> size_t n; /* Length to compare. */
> {
> - CONST unsigned char *ptr1 = (CONST unsigned char *) s1;
> - CONST unsigned char *ptr2 = (CONST unsigned char *) s2;
> + CONST unsigned char *ptr1 = (CONST unsigned char *) s1_arg;
> + CONST unsigned char *ptr2 = (CONST unsigned char *) s2_arg;
>
> for ( ; n-- ; ptr1++, ptr2++) {
> - unsigned char u1 = *s1, u2 = *s2;
> + unsigned char u1 = *ptr1, u2 = *ptr2;
>
> if ( u1 != u2) {
> return (u1-u2);
>
>
> _______________________________________________
> Pkg-tcltk-devel mailing list
> Pkg-tcltk-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-tcltk-devel
>
More information about the Pkg-tcltk-devel
mailing list