diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2017-05-31 11:35:39 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2017-05-31 11:35:39 +0000 |
commit | 4532f01643c46705f703bf694c09bb32348e8000 (patch) | |
tree | f07e539bc380cc9a86a7d52e538c31e0772f59d6 /usr/src | |
parent | 539be8d67e75fbd3dbdebfb93ba8ec220779f0dc (diff) | |
parent | afc62b4b94eec9d9cec1ba14fd65fcf304325e7f (diff) | |
download | illumos-joyent-4532f01643c46705f703bf694c09bb32348e8000.tar.gz |
[illumos-gate merge]
commit afc62b4b94eec9d9cec1ba14fd65fcf304325e7f
6961 64-bit octal printf may overflow internal buffer
commit a5ae00988088f44766fb28f575751986b222edbc
8298 snoop: dhcp option_types list is missing strings
commit 5cb835500e9cd5a521ccc0bbd3d2d15ea11a997f
8191 in.routed: misleading-indentation
commit 92e800cb34cfa1782db2b305db525b6853deb198
8162 cscope-fast: this statement may fall through
commit a4e73d5d60e566669c550027fae2b1d87b4be2b4
8240 AVX512 dis - opmask instruction support
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c | 5 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcp.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libc/port/print/print.h | 4 | ||||
-rw-r--r-- | usr/src/pkg/manifests/system-test-libctest.mf | 1 | ||||
-rw-r--r-- | usr/src/pkg/manifests/system-test-utiltest.mf | 4 | ||||
-rw-r--r-- | usr/src/test/libc-tests/runfiles/default.run | 3 | ||||
-rw-r--r-- | usr/src/test/libc-tests/tests/Makefile | 4 | ||||
-rw-r--r-- | usr/src/test/libc-tests/tests/printf-6961.c | 115 | ||||
-rw-r--r-- | usr/src/tools/cscope-fast/global.h | 2 | ||||
-rw-r--r-- | usr/src/tools/cscope-fast/scanner.l | 4 |
10 files changed, 133 insertions, 11 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c index 5840be8584..31084ade7a 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c @@ -1478,9 +1478,8 @@ sync_kern(void) sizeof (rp->ipRouteIfIndex.o_bytes)) rp->ipRouteIfIndex.o_bytes[ rp->ipRouteIfIndex.o_length] = '\0'; - (void) strncpy(ifname, - rp->ipRouteIfIndex.o_bytes, - sizeof (ifname)); + (void) strncpy(ifname, rp->ipRouteIfIndex.o_bytes, + sizeof (ifname)); /* * First try to match up on gwkludge entries diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcp.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcp.c index 7857da7d53..b94c8246cb 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcp.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcp.c @@ -112,6 +112,8 @@ static char *option_types[] = { "Client Identifier =", /* 61 */ "Netware IP Domain =", /* 62 */ "Netware IP Options =", /* 63 */ +"NIS+ v3 Client Domain Name =", /* 64 */ +"NIS+ v3 Server Addresses =", /* 65 */ "TFTP Server Name", /* 66 */ "Option BootFile Name", /* 67 */ "Mobile IP Agents", /* 68 */ diff --git a/usr/src/lib/libc/port/print/print.h b/usr/src/lib/libc/port/print/print.h index 427d32677a..bbc2c8ee7d 100644 --- a/usr/src/lib/libc/port/print/print.h +++ b/usr/src/lib/libc/port/print/print.h @@ -31,8 +31,6 @@ #ifndef _PRINT_H #define _PRINT_H -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ - #include "file64.h" #include <floatingpoint.h> #include <thread.h> @@ -63,7 +61,7 @@ __qaconvert(long double *arg, int ndigits, int *exp, int *sign, char *buf); #define MAXDIGS 11 /* Maximum number of digits in any long long representation */ -#define MAXLLDIGS 21 +#define MAXLLDIGS 22 /* Maximum total number of digits in E format */ #define MAXECVT (DECIMAL_STRING_LENGTH-1) diff --git a/usr/src/pkg/manifests/system-test-libctest.mf b/usr/src/pkg/manifests/system-test-libctest.mf index 16ec75f259..558dbdb622 100644 --- a/usr/src/pkg/manifests/system-test-libctest.mf +++ b/usr/src/pkg/manifests/system-test-libctest.mf @@ -93,6 +93,7 @@ file path=opt/libc-tests/tests/newlocale_test.$(ARCH64) mode=0555 file path=opt/libc-tests/tests/nl_langinfo_test mode=0555 file path=opt/libc-tests/tests/nl_langinfo_test.$(ARCH) mode=0555 file path=opt/libc-tests/tests/nl_langinfo_test.$(ARCH64) mode=0555 +file path=opt/libc-tests/tests/printf-6961.64 mode=0555 file path=opt/libc-tests/tests/priv_gettext mode=0555 file path=opt/libc-tests/tests/pthread_attr_get_np mode=0555 file path=opt/libc-tests/tests/quick_exit mode=0555 diff --git a/usr/src/pkg/manifests/system-test-utiltest.mf b/usr/src/pkg/manifests/system-test-utiltest.mf index e3ca1b6692..eacc8a3f52 100644 --- a/usr/src/pkg/manifests/system-test-utiltest.mf +++ b/usr/src/pkg/manifests/system-test-utiltest.mf @@ -60,6 +60,8 @@ file path=opt/util-tests/tests/dis/i386/32.lzcnt.out mode=0555 file path=opt/util-tests/tests/dis/i386/32.lzcnt.s mode=0555 file path=opt/util-tests/tests/dis/i386/32.movbe.out mode=0555 file path=opt/util-tests/tests/dis/i386/32.movbe.s mode=0555 +file path=opt/util-tests/tests/dis/i386/32.opmask.out mode=0555 +file path=opt/util-tests/tests/dis/i386/32.opmask.s mode=0555 file path=opt/util-tests/tests/dis/i386/32.pclmulqdq.out mode=0555 file path=opt/util-tests/tests/dis/i386/32.pclmulqdq.s mode=0555 file path=opt/util-tests/tests/dis/i386/32.popcnt.out mode=0555 @@ -104,6 +106,8 @@ file path=opt/util-tests/tests/dis/i386/64.lzcnt.out mode=0555 file path=opt/util-tests/tests/dis/i386/64.lzcnt.s mode=0555 file path=opt/util-tests/tests/dis/i386/64.movbe.out mode=0555 file path=opt/util-tests/tests/dis/i386/64.movbe.s mode=0555 +file path=opt/util-tests/tests/dis/i386/64.opmask.out mode=0555 +file path=opt/util-tests/tests/dis/i386/64.opmask.s mode=0555 file path=opt/util-tests/tests/dis/i386/64.pclmulqdq.out mode=0555 file path=opt/util-tests/tests/dis/i386/64.pclmulqdq.s mode=0555 file path=opt/util-tests/tests/dis/i386/64.popcnt.out mode=0555 diff --git a/usr/src/test/libc-tests/runfiles/default.run b/usr/src/test/libc-tests/runfiles/default.run index f0c240f154..845aa3492d 100644 --- a/usr/src/test/libc-tests/runfiles/default.run +++ b/usr/src/test/libc-tests/runfiles/default.run @@ -12,7 +12,7 @@ # # Copyright (c) 2012 by Delphix. All rights reserved. # Copyright 2014 Garrett D'Amore <garrett@damore.org> -# Copyright 2016 Joyent, Inc. +# Copyright 2017 Joyent, Inc. # [DEFAULT] @@ -76,6 +76,7 @@ timeout = 600 [/opt/libc-tests/tests/endian.32] [/opt/libc-tests/tests/endian.64] [/opt/libc-tests/tests/quick_exit] +[/opt/libc-tests/tests/printf-6961.64] [/opt/libc-tests/tests/priv_gettext] [/opt/libc-tests/tests/strerror] [/opt/libc-tests/tests/timespec_get.32] diff --git a/usr/src/test/libc-tests/tests/Makefile b/usr/src/test/libc-tests/tests/Makefile index c982c03c1f..c393844ea0 100644 --- a/usr/src/test/libc-tests/tests/Makefile +++ b/usr/src/test/libc-tests/tests/Makefile @@ -51,7 +51,9 @@ SCRIPTS = \ CPPFLAGS += -D_REENTRANT PROGS32 = $(PROGS:%=%.32) -PROGS64 = $(PROGS:%=%.64) +PROGS64 = \ + $(PROGS:%=%.64) \ + printf-6961.64 aligned_alloc.32 := LDLIBS += -lproc aligned_alloc.64 := LDLIBS64 += -lproc diff --git a/usr/src/test/libc-tests/tests/printf-6961.c b/usr/src/test/libc-tests/tests/printf-6961.c new file mode 100644 index 0000000000..5c60b96425 --- /dev/null +++ b/usr/src/test/libc-tests/tests/printf-6961.c @@ -0,0 +1,115 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2017 Joyent, Inc. + */ + +/* + * Regression test for illumos #6961. We mistakenly zeroed out a character that + * we shouldn't have when dealing with a 64-bit libc. + */ + +#include <stdio.h> +#include <string.h> +#include <strings.h> +#include <stdlib.h> + +static void +print_diff(char *test, char *correct, char *wrong) +{ + int i; + printf("test failed: received incorrect octal for case %s\n", test); + for (i = 0; i < 32; i++) { + printf("byte %d: expected 0x%x, found 0x%x\n", i, correct[i], + wrong[i]); + } +} + +int +main(void) +{ + int ret = 0; + char buf[32]; + + /* ~0L in octal */ + char octal0[] = { 'r', 'r', 'r', 'r', '1', '7', '7', '7', '7', '7', '7', + '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', + '7', '7', '\0', 'r', 'r', 'r', 'r', 'r', 'r' }; + + char decimal0[] = { 'r', 'r', 'r', 'r', '-', '1', '\0', 'r', 'r', 'r', + 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', + 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r' }; + + char hex0[] = { 'r', 'r', 'r', 'r', 'f', 'f', 'f', 'f', 'f', 'f', + 'f', 'f', 'f', 'f', 'f', 'f', 'f', 'f', 'f', 'f', '\0', 'r', 'r', + 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r' }; + + /* 42 in octal */ + char octal1[] = { 'r', 'r', 'r', 'r', '5', '2', '\0', 'r', 'r', 'r', + 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', + 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r' }; + + /* 42 in decimal */ + char decimal1[] = { 'r', 'r', 'r', 'r', '4', '2', '\0', 'r', 'r', 'r', + 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', + 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r' }; + + /* 42 in hex */ + char hex1[] = { 'r', 'r', 'r', 'r', '2', 'a', '\0', 'r', 'r', 'r', 'r', + 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', + 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r' }; + + + (void) memset(buf, 'r', sizeof (buf)); + (void) snprintf(buf + 4, sizeof (buf), "%lo", ~0L); + if (bcmp(octal0, buf, sizeof (buf)) != 0) { + print_diff("~0 in Octal", octal0, buf); + ret++; + } + + (void) memset(buf, 'r', sizeof (buf)); + (void) snprintf(buf + 4, sizeof (buf), "%lo", 42L); + if (bcmp(octal1, buf, sizeof (buf)) != 0) { + print_diff("42 in Octal", octal1, buf); + ret++; + } + + (void) memset(buf, 'r', sizeof (buf)); + (void) snprintf(buf + 4, sizeof (buf), "%ld", ~0L); + if (bcmp(decimal0, buf, sizeof (buf)) != 0) { + print_diff("~0 in Decimal", decimal0, buf); + ret++; + } + + (void) memset(buf, 'r', sizeof (buf)); + (void) snprintf(buf + 4, sizeof (buf), "%ld", 42L); + if (bcmp(decimal1, buf, sizeof (buf)) != 0) { + print_diff("42 in Decimal", decimal1, buf); + ret++; + } + + (void) memset(buf, 'r', sizeof (buf)); + (void) snprintf(buf + 4, sizeof (buf), "%lx", ~0L); + if (bcmp(hex0, buf, sizeof (buf)) != 0) { + print_diff("~0 in Hex", hex0, buf); + ret++; + } + + (void) memset(buf, 'r', sizeof (buf)); + (void) snprintf(buf + 4, sizeof (buf), "%lx", 42L); + if (bcmp(hex1, buf, sizeof (buf)) != 0) { + print_diff("42 in Hex", hex1, buf); + ret++; + } + + return (ret); +} diff --git a/usr/src/tools/cscope-fast/global.h b/usr/src/tools/cscope-fast/global.h index 2d963983f0..da99f16ad0 100644 --- a/usr/src/tools/cscope-fast/global.h +++ b/usr/src/tools/cscope-fast/global.h @@ -283,7 +283,7 @@ int hash(char *s); void rebuild(void); void entercurses(void); void exitcurses(void); -void myexit(int sig); +void myexit(int sig) __NORETURN; void cannotopen(char *file); void cannotwrite(char *file); diff --git a/usr/src/tools/cscope-fast/scanner.l b/usr/src/tools/cscope-fast/scanner.l index 5902784fd4..391bbf05f4 100644 --- a/usr/src/tools/cscope-fast/scanner.l +++ b/usr/src/tools/cscope-fast/scanner.l @@ -27,8 +27,6 @@ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * cscope - interactive C symbol cross-reference * @@ -996,6 +994,8 @@ do_assembly(int token) return (FCNCALL); } + /* FALLTHROUGH */ + default: /* Default to normal behavior. */ return (token); |