NetBSD Problem Report #49871
From mlelstv@twitty.1st.de Sun May 3 08:46:49 2015
Return-Path: <mlelstv@twitty.1st.de>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id C5CD6A654C
for <gnats-bugs@gnats.NetBSD.org>; Sun, 3 May 2015 08:46:49 +0000 (UTC)
Message-Id: <20150503084633.2E054457@twitty.1st.de>
Date: Sun, 3 May 2015 10:46:33 +0200 (CEST)
From: mlelstv@serpens.de
Reply-To: mlelstv@serpens.de
To: gnats-bugs@NetBSD.org
Subject: strunvis cannot decode strvis output
X-Send-Pr-Version: 3.95
>Number: 49871
>Category: lib
>Synopsis: strunvis cannot decode strvis output
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 03 08:50:01 +0000 2015
>Originator: Michael van Elst
>Release: NetBSD 7.99.12
>Organization:
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."
>Environment:
System: NetBSD twitty 7.99.12 NetBSD 7.99.12 (HOPPA) #8: Sun Apr 26 13:29:18 CEST 2015 mlelstv@pussyfoot:/home/netbsd-current/obj.evbarm/home/netbsd-current/src/sys/arch/evbarm/compile/HOPPA evbarm
Architecture: earmv6hf
Machine: evbarm
>Description:
strvis produces a somewhat readable encoding of arbitrary strings
or (with strvisx) byte sequences. strunvis is supposed to decode
the output into the the original string or byte sequence.
However, strvis can produce the sequence '\\','-',c for a byte
value c between 0 and 127 under rare conditions. This sequence
is not even a valid encoding as understood by strunvis.
strvis/strunvis is used by utmp_update to pass a binary structure
to the utmp_update program. This fails when the binary structure
contains a byte sequence that is misinterpreted that way.
>How-To-Repeat:
#include <stdio.h>
#include <vis.h>
#include <locale.h>
int main()
{
char input[] = "\335\272";
char output[(sizeof(input)-1)*4+1];
setlocale(LC_ALL, "de_DE.UTF-8");
strvisx(output, input, sizeof(input)-1, VIS_WHITE);
printf("%s\n", output);
return 0;
}
prints \^G\-z
Note, that the input is not a valid multibyte sequence, but strvis
is supposed to handle this.
>Fix:
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.