summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2017-02-19 00:10:57 +0000
committerdjm <djm@openbsd.org>2017-02-19 00:10:57 +0000
commit5786b0f9abe4ab96e4eca38677099da26042c76f (patch)
tree5f8a2f780aa64d6bcf14f972b1a05b5566f9b08b
parentUse more specific error codes for invalid packets. (diff)
downloadwireguard-openbsd-5786b0f9abe4ab96e4eca38677099da26042c76f.tar.xz
wireguard-openbsd-5786b0f9abe4ab96e4eca38677099da26042c76f.zip
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@
-rw-r--r--usr.bin/ssh/utf8.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/ssh/utf8.c b/usr.bin/ssh/utf8.c
index d7382807d84..5172bcc847d 100644
--- a/usr.bin/ssh/utf8.c
+++ b/usr.bin/ssh/utf8.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utf8.c,v 1.4 2017/02/02 10:54:25 jsg Exp $ */
+/* $OpenBSD: utf8.c,v 1.5 2017/02/19 00:10:57 djm Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -51,7 +51,8 @@ dangerous_locale(void) {
char *loc;
loc = nl_langinfo(CODESET);
- return strcmp(loc, "US-ASCII") && strcmp(loc, "UTF-8");
+ return strcmp(loc, "US-ASCII") != 0 && strcmp(loc, "UTF-8") != 0 &&
+ strcmp(loc, "ANSI_X3.4-1968") != 0;
}
static int