When running www/squidguard on amd64 (and I assume other 64-bit platforms), it segfaults. It fails in the call to the sgDbUpdate function:
sgDbUpdate(sp->userDb, user, (char *) setuserinfo(), sizeof(struct UserInfo)); This code would be fine, except that setuserinfo is not actually declared. When you call an undeclared function in C, it assumes a return type of int, which is 32-bit on amd64. However, it should be returning a 64-bit pointer. So you end up losing the high bits in the pointer, and it no longer references a valid address. The only reason this doesn't fail on 32-bit platforms is that sizeof(int) == sizeof(char *) on those platforms. Found the hard way by me. I tried to report it upstream, but their bugtracker appears to be down. OKs for the patch below? Thanks, Jeremy Index: Makefile =================================================================== RCS file: /cvs/ports/www/squidguard/Makefile,v retrieving revision 1.18 diff -u -p -r1.18 Makefile --- Makefile 12 Jun 2013 20:36:34 -0000 1.18 +++ Makefile 12 Aug 2013 17:09:29 -0000 @@ -3,7 +3,7 @@ COMMENT = filter, redirector and access controller for Squid DISTNAME = squidGuard-1.4 -REVISION = 6 +REVISION = 7 CATEGORIES = www HOMEPAGE = http://www.squidguard.org/ Index: patches/patch-src_sg_h_in =================================================================== RCS file: /cvs/ports/www/squidguard/patches/patch-src_sg_h_in,v retrieving revision 1.1 diff -u -p -r1.1 patch-src_sg_h_in --- patches/patch-src_sg_h_in 9 Feb 2010 13:44:28 -0000 1.1 +++ patches/patch-src_sg_h_in 12 Aug 2013 16:58:14 -0000 @@ -2,8 +2,12 @@ $OpenBSD: patch-src_sg_h_in,v 1.1 2010/0 squidGuard 1.4 patch 20091019; increase MAX_BUF above squid's MAX_URL value. ---- src/sg.h.in.orig Fri Nov 16 16:58:32 2007 -+++ src/sg.h.in Wed Feb 3 12:26:15 2010 +Fix segfault on 64-bit due to calling an undeclared function. The function +is supposed to return a pointer (64-bit) but when undeclared returns an int +(32-bit). + +--- src/sg.h.in.orig Fri Nov 16 08:58:32 2007 ++++ src/sg.h.in Mon Aug 12 02:40:28 2013 @@ -73,7 +73,7 @@ int tolower(); #define REQUEST_TYPE_REDIRECT 2 #define REQUEST_TYPE_PASS 3 @@ -13,3 +17,11 @@ squidGuard 1.4 patch 20091019; increase #define DEFAULT_LOGFILE "squidGuard.log" #define WARNING_LOGFILE "squidGuard.log" +@@ -412,6 +412,7 @@ char *niso __P((time_t)); + struct UserQuotaInfo *setuserquota __P(()); + void sgSourceUserQuota __P((char *, char *, char *)); + ++struct UserInfo *setuserinfo(); + + void *sgMalloc __P((size_t)); + void *sgCalloc __P((size_t, size_t));