NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/59657: syslogd outputs BOM in the message



>Number:         59657
>Category:       bin
>Synopsis:       syslogd outputs BOM in the message
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 17 01:25:00 +0000 2025
>Originator:     Benedek Gergely
>Release:        10.99.12
>Organization:
>Environment:
NetBSD funcube 10.99.12 NetBSD 10.99.12 (FUNCUBE) #68: Sat Jul 26 15:34:52 BST 2025  potato@funcube:/usr/obj/sys/arch/amd64/compile/FUNCUBE amd64
>Description:
SYSLOG(3) and rfc5424 similarly state: 

"If the msgfmt contains UTF-8 characters, then it has to start with 
a Byte Order Mark."


The BOM is unexpected as a prefix for every message logged:

2025-09-17T01:59:10.205820+01:00 funcube potato - - - <feff>Árvízt&#369;r&#337; tükörfúrógép
>How-To-Repeat:
syslogd -o rfc5424 -d

logger $(printf "\xEF\xBB\xBF%s" "Árvízt&#369;r&#337; tükörfúrógép")



tail -n 1 /var/log/messages | xxd
00000000: 3230 3235 2d30 392d 3137 5430 313a 3539  2025-09-17T01:59
00000010: 3a31 302e 3230 3538 3230 2b30 313a 3030  :10.205820+01:00
00000020: 2066 756e 6375 6265 2070 6f74 6174 6f20   funcube potato 
00000030: 2d20 2d20 2d20 efbb bfc3 8172 76c3 ad7a  - - - .....rv..z
00000040: 74c5 b172 c591 2074 c3bc 6bc3 b672 66c3  t..r.. t..k..rf.
00000050: ba72 c3b3 67c3 a970 0a                   .r..g..p.


>Fix:
Index: ./usr.sbin/syslogd/syslogd.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.147
diff -u -r1.147 syslogd.c
--- ./usr.sbin/syslogd/syslogd.c        9 Nov 2024 16:31:31 -0000       1.147
+++ ./usr.sbin/syslogd/syslogd.c        17 Sep 2025 01:08:30 -0000
@@ -1243,6 +1243,7 @@
                DPRINTF(D_DATA, "UTF-8 BOM\n");
                utf8allowed = true;
                p += 3;
+               start += 3;  /* skip BOM in output */
        }
 
        if (*p != '\0' && !utf8allowed) {



Home | Main Index | Thread Index | Old Index