History log of /freebsd/contrib/libc-vis/vis.c (Results 1 – 23 of 23)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# ea2be8ed 21-Nov-2023 Brooks Davis <brooks@FreeBSD.org>

Remove __FBSDID from netbsd libc sources

I added them per then-current practice when I imported them, but now
they are just gratuious local diffs.

Reviewed by: imp
Differential Revision: https://re

Remove __FBSDID from netbsd libc sources

I added them per then-current practice when I imported them, but now
they are just gratuious local diffs.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42686

show more ...


# db94e7c3 21-Nov-2023 Brooks Davis <brooks@FreeBSD.org>

vis: relocate _DIAGASSERT() define

Other similar files from NetBSD define it unconditionally as a local
diff.

Reviewed by: imp (as part of D42686)


Revision tags: release/14.0.0
# 09078445 13-Aug-2023 Kyle Evans <kevans@FreeBSD.org>

vis(3): need <stdint.h> for SIZE_MAX


# ea46e638 13-Aug-2023 Kyle Evans <kevans@FreeBSD.org>

Merge commit 'acb089b983171667467adc66f56a723b609ed22e' into kbsd/vis

Highlights:
- Some style fixes
- Bumped mbbuf in istrsenvisx() to MB_LEN_MAX to avoid VLAs
- mbslength cannot go negative, so ma

Merge commit 'acb089b983171667467adc66f56a723b609ed22e' into kbsd/vis

Highlights:
- Some style fixes
- Bumped mbbuf in istrsenvisx() to MB_LEN_MAX to avoid VLAs
- mbslength cannot go negative, so make it unsigned
- Further bounds checking & fix an additional overrun, with dlen == 0
- Avoid duplicate call to wcslen(start)

show more ...


# 2f489a50 08-Aug-2023 Kyle Evans <kevans@FreeBSD.org>

libc: fix some overflow scenarios in vis(3)

The previous incarnation of this would call wcrtomb() on the destination
buffer, and only check for overflow *after* it's happened.
Additionally, the conv

libc: fix some overflow scenarios in vis(3)

The previous incarnation of this would call wcrtomb() on the destination
buffer, and only check for overflow *after* it's happened.
Additionally, the conversion error / VIS_NOLOCALE path also didn't check
for overflow, and the overflow check at the end didn't account for the
fact that we still need to write a NUL terminator afterward.

Start by only doing the multibyte conversion into mbdst directly if we
have enough buffer space to guarantee it'll fit. An additional
MB_CUR_MAX buffer has been stashed on the stack to write into if we're
cutting it close at the end of the buffer, since we don't really have a
good way to determine the length of the wchar_t without just doing the
conversion. We'll do the conversion into the buffer that's guaranteed
to fit, then copy it over if the copy won't overflow.

The byte-for-byte overflow is a little bit easier, as we simply check
for overflow with each byte written and make sure we can still NUL
terminate after.

Tests added to exercise these edge cases.

Reviewed by: des
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D41328

show more ...


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0
# 1a2f06d0 16-Jun-2021 Alex Richardson <arichardson@FreeBSD.org>

vis(3): avoid out-of-bounds stack buffer reads

I found this while running kdump(1) on a CheriBSD system due to a
capability length violation when printing the /etc/libmap.conf read()
system call: it

vis(3): avoid out-of-bounds stack buffer reads

I found this while running kdump(1) on a CheriBSD system due to a
capability length violation when printing the /etc/libmap.conf read()
system call: it crashed immediately after printing the first line.

Found by: CHERI
Reviewed By: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30771

show more ...


Revision tags: release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0
# ff88ef41 28-Nov-2017 Brooks Davis <brooks@FreeBSD.org>

Update vis(3) the latest from NetBSD.

This adds VIS_DQ for compatiblity with OpenBSD.

Correct by an off-by-one error and a read buffer overflow detected using
asan.

MFC after: 1 day


Revision tags: release/10.4.0, release/11.1.0
# 1bde3b70 09-Dec-2016 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r309519 through r309757.


# f0a6d7e2 06-Dec-2016 Bryan Drewery <bdrewery@FreeBSD.org>

strvis(3): Avoid internal state of multibyte functions being tainted.

The mbtoc(3) and wctomb(3) functions use internal state which may be
tainted before the call to strvis(3). In this context we c

strvis(3): Avoid internal state of multibyte functions being tainted.

The mbtoc(3) and wctomb(3) functions use internal state which may be
tainted before the call to strvis(3). In this context we can just use
the thread-safe versions mbrtoc(3) and wcrtomb(3) which allow passing
our own state from our stack.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

show more ...


Revision tags: release/11.0.1, release/11.0.0
# 8dfeba04 08-Jun-2016 Brooks Davis <brooks@FreeBSD.org>

Update to a June 8th snapshot of (un)vis form NetBSD.

This adds stravis() and some new encoding flags VIS_SHELL, VIS_META,
and VIS_NOLOCALE.

Assorted cleanups and fixes includeing a manpage typo[0]

Update to a June 8th snapshot of (un)vis form NetBSD.

This adds stravis() and some new encoding flags VIS_SHELL, VIS_META,
and VIS_NOLOCALE.

Assorted cleanups and fixes includeing a manpage typo[0].

PR: 210013 [0]
Submitted by: pi [0]

show more ...


Revision tags: release/10.3.0, release/10.2.0
# 9268022b 19-Nov-2014 Simon J. Gerraty <sjg@FreeBSD.org>

Merge from head@274682


Revision tags: release/10.1.0
# 1ce4b357 04-Oct-2014 Alexander V. Chernikov <melifaro@FreeBSD.org>

Sync to HEAD@r272516.


# 4e27d36d 17-Sep-2014 Neel Natu <neel@FreeBSD.org>

IFC @r271694


# ac25e238 08-Sep-2014 Brooks Davis <brooks@FreeBSD.org>

Merge from NetBSD:

PR/49185: Conrad Meyer: strvisx: Handle zero-length input strings
gracefully. (don't abuse 0 to mean compute string length internally)

PR: 193447
Submitted by: Conrad Meyer <co

Merge from NetBSD:

PR/49185: Conrad Meyer: strvisx: Handle zero-length input strings
gracefully. (don't abuse 0 to mean compute string length internally)

PR: 193447
Submitted by: Conrad Meyer <conrad.meyer@isilon.com>
MFC after: 1 month

show more ...


Revision tags: release/9.3.0, release/10.0.0, release/9.2.0
# 552311f4 17-Jul-2013 Xin LI <delphij@FreeBSD.org>

IFC @253398


# cfe30d02 19-Jun-2013 Gleb Smirnoff <glebius@FreeBSD.org>

Merge fresh head.


Revision tags: release/8.4.0
# 69e6d7b7 12-Apr-2013 Simon J. Gerraty <sjg@FreeBSD.org>

sync from head


# 876a84e8 18-Mar-2013 Martin Matuska <mm@FreeBSD.org>

MFC @248461


# 778c12a6 15-Mar-2013 Brooks Davis <brooks@FreeBSD.org>

Update to the latest (un)vis(3) sources from NetBSD. This adds
multibyte support[0] and the new functions strenvisx and strsenvisx.

Add MLINKS for vis(3) functions add by this and the initial impor

Update to the latest (un)vis(3) sources from NetBSD. This adds
multibyte support[0] and the new functions strenvisx and strsenvisx.

Add MLINKS for vis(3) functions add by this and the initial import from
NetBSD[1].

PR: bin/166364, bin/175418
Submitted by: "J.R. Oldroyd" <fbsd@opal.com>[0]
stefanf[1]
Obtained from: NetBSD
MFC after: 2 weeks

show more ...


# d241a0e6 26-Feb-2013 Xin LI <delphij@FreeBSD.org>

IFC @247348.


# d9a44755 08-Feb-2013 David E. O'Brien <obrien@FreeBSD.org>

Sync with HEAD.


# 46b1c55d 04-Jan-2013 Neel Natu <neel@FreeBSD.org>

IFC @ r244983.


# 8ccca122 18-Dec-2012 Brooks Davis <brooks@FreeBSD.org>

Replace our implementation of the vis(3) and unvis(3) APIs with
NetBSD's. This output size limited versions of vis and unvis functions
as well as a set of vis variants that allow arbitrary character

Replace our implementation of the vis(3) and unvis(3) APIs with
NetBSD's. This output size limited versions of vis and unvis functions
as well as a set of vis variants that allow arbitrary characters to be
specified for encoding.

Finally, MIME Quoted-Printable encoding as described in RFC 2045 is
supported.

show more ...