Date: Wed, 08 Jan 2020 01:56:06 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 243164] blacklistd not handling masks correctly Message-ID: <bug-243164-227-djsDrm4Rhn@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-243164-227@https.bugs.freebsd.org/bugzilla/> References: <bug-243164-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D243164 --- Comment #3 from Conrad Meyer <cem@freebsd.org> --- Ah. I wonder if this is it? 459 #define MASK(m) ((uint32_t)~((1 << (32 - (m))) - 1)) 460 461 static int 462 conf_amask_eq(const void *v1, const void *v2, size_t len, int mask) 463 { 464 const uint32_t *a1 =3D v1; 465 const uint32_t *a2 =3D v2; 466 uint32_t m; 467 int omask =3D mask; 468 469 len >>=3D 2; 470 switch (mask) { 471 case FSTAR: 472 if (memcmp(v1, v2, len) =3D=3D 0) 473 return 1; 474 goto out; // Above is definitely wrong, only compares the first 1/4 of the address // bytes. Maybe that's what we're seeing? ... 484 for (size_t i =3D 0; i < len; i++) { 485 if (mask > 32) { 486 m =3D htonl((uint32_t)~0); 487 mask -=3D 32; 488 } else if (mask) { 489 m =3D htonl(MASK(mask)); 490 mask =3D 0; 493 if ((a1[i] & m) !=3D (a2[i] & m)) 494 goto out; // This part seems fine for v4, but I'm not sure if it's correct for v6. 495 } 496 return 1; 497 out: ... 506 return 0; --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-243164-227-djsDrm4Rhn>