OpenBSD CVS

CVS log for src/usr.bin/ssh/utf8.c


[BACK] Up to [local] / src / usr.bin / ssh

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.11 / (download) - annotate - [select for diffs], Fri May 1 06:28:52 2020 UTC (4 years ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, HEAD
Changes since 1.10: +2 -3 lines
Diff to previous 1.10 (colored)

expose vasnmprintf(); ok (as part of other commit) markus deraadt

Revision 1.10 / (download) - annotate - [select for diffs], Fri Apr 3 02:25:21 2020 UTC (4 years, 1 month ago) by djm
Branch: MAIN
Changes since 1.9: +15 -1 lines
Diff to previous 1.9 (colored)

add allocating variant of the safe utf8 printer; ok dtucker as part of
a larger diff

Revision 1.9 / (download) - annotate - [select for diffs], Fri Mar 6 18:12:55 2020 UTC (4 years, 2 months ago) by markus
Branch: MAIN
Changes since 1.8: +6 -4 lines
Diff to previous 1.8 (colored)

vasnmprintf allocates str and returns -1; ok djm

Revision 1.8 / (download) - annotate - [select for diffs], Tue Aug 21 13:56:27 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.7: +9 -4 lines
Diff to previous 1.7 (colored)

AIX reports the CODESET as "ISO8859-1" in the POSIX locale.
Treating that as a safe encoding is OK because even when other
systems return that string for real ISO8859-1, it is still
safe in the sense that it is ASCII-compatible and stateless.

Issue reported by Val dot Baranov at duke dot edu.  Additional
information provided by Michael dot Felt at felt dot demon dot nl.
Tested by Michael Felt on AIX 6.1 and by Val Baranov on AIX 7.1.
Tweak and OK djm@.

Revision 1.7 / (download) - annotate - [select for diffs], Wed May 31 09:15:42 2017 UTC (6 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

Switch to recallocarray() for a few operations.  Both growth and shrinkage
are handled safely, and there also is no need for preallocation dances.
Future changes in this area will be less error prone.
Review and one bug found by markus

Revision 1.6 / (download) - annotate - [select for diffs], Mon Apr 17 14:31:23 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.5: +3 -2 lines
Diff to previous 1.5 (colored)

Recognize nl_langinfo(CODESET) return values "646" and "" as aliases
for "US-ASCII", useful for different versions of NetBSD and Solaris.
Found by dtucker@ and by Tom G. Christensen <tgc at jupiterrise dot com>.
OK dtucker@ deraadt@

Revision 1.5 / (download) - annotate - [select for diffs], Sun Feb 19 00:10:57 2017 UTC (7 years, 2 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.4: +3 -2 lines
Diff to previous 1.4 (colored)

Add a common nl_langinfo(CODESET) alias for US-ASCII "ANSI_X3.4-1968"
that is used by Linux. Fixes mprintf output truncation for non-UTF-8
locales on Linux spotted by dtucker@; ok deraadt@ schwarze@

Revision 1.4 / (download) - annotate - [select for diffs], Thu Feb 2 10:54:25 2017 UTC (7 years, 3 months ago) by jsg
Branch: MAIN
Changes since 1.3: +2 -1 lines
Diff to previous 1.3 (colored)

In vasnmprintf() return an error if malloc fails and don't set
a function argument to the address of free'd memory.

ok djm@

Revision 1.3 / (download) - annotate - [select for diffs], Mon May 30 12:57:21 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.2: +31 -15 lines
Diff to previous 1.2 (colored)

Even when only writing an unescaped character, the dst buffer may need to
grow, or it would be overrun; issue found by tb@ with malloc.conf(5) 'C'.

While here, reserve an additional byte for the terminating NUL
up front such that we don't have to realloc() later just for that.

OK tb@

Revision 1.2 / (download) - annotate - [select for diffs], Mon May 30 12:05:56 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.1: +18 -10 lines
Diff to previous 1.1 (colored)

Fix two rare edge cases:
1. If vasprintf() returns < 0, do not access a NULL pointer in snmprintf(),
and do not free() the pointer returned from vasprintf() because on some
systems other than OpenBSD, it might be a bogus pointer.
2. If vasprintf() returns == 0, return 0 and "" rather than -1 and NULL.

Besides, free(dst) is pointless after failure (not a bug).

One half OK martijn@, the other half OK deraadt@;
committing quickly before people get hurt.

Revision 1.1 / (download) - annotate - [select for diffs], Wed May 25 23:48:45 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN

To prevent screwing up terminal settings when printing to the
terminal, for ASCII and UTF-8, escape bytes not forming characters
and bytes forming non-printable characters with vis(3) VIS_OCTAL.
For other character sets, abort printing of the current string in
these cases.  In particular,
* let scp(1) respect the local user's LC_CTYPE locale(1);
* sanitize data received from the remote host;
* sanitize filenames, usernames, and similar data even locally;
* take character display widths into account for the progressmeter.

This is believed to be sufficient to keep the local terminal safe
on OpenBSD, but bad things can still happen on other systems with
state-dependent locales because many places in the code print
unencoded ASCII characters into the output stream.

Using feedback from djm@ and martijn@,
various aspects discussed with many others.

deraadt@ says it should go in now, i probably already hesitated too long

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.