Fix security/p0f -fno-common

Bonus fix for memset size mismatch noted by clang

ok jsg@
This commit is contained in:
gnezdo 2021-02-10 07:26:38 +00:00
parent 58843875ca
commit c4d57edd17
2 changed files with 31 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.27 2019/07/12 20:49:06 sthen Exp $ # $OpenBSD: Makefile,v 1.28 2021/02/10 07:26:38 gnezdo Exp $
COMMENT= passive OS fingerprinting tool COMMENT= passive OS fingerprinting tool
DISTNAME= p0f-2.0.8 DISTNAME= p0f-2.0.8
REVISION = 2 REVISION = 3
EXTRACT_SUFX= .tgz EXTRACT_SUFX= .tgz
CATEGORIES= security net CATEGORIES= security net

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-p0f-query_c,v 1.1 2021/02/10 07:26:38 gnezdo Exp $
-fno-common
Fix memset size mismatch
Index: p0f-query.c
--- p0f-query.c.orig
+++ p0f-query.c
@@ -46,8 +46,8 @@ static _u16 flags;
static _s16 score = NO_SCORE;
/* Imports for statistics */
-_u32 packet_count, matched_packets, st_time, file_cksum;
-_u8 operating_mode;
+extern _u32 packet_count, matched_packets, st_time, file_cksum;
+extern _u8 operating_mode;
#define SAD_HASH(a) ((((a) << 16) ^ ((a) << 8) ^ (a)))
@@ -74,7 +74,7 @@ void p0f_addcache(_u32 saddr,_u32 daddr,_u16 sport,_u1
cur->dad = daddr;
cur->ports = (sport << 16) + dport;
- memset(sc,0,sizeof(sc));
+ memset(sc,0,sizeof(*sc));
if (genre) {
strncpy(sc->genre,genre,19);
strncpy(sc->detail,detail,39);