NetBSD/sbin
kamil 5f51a87ea5 Correct Undefined Behavior in ifconfig(8)
Unportable left shift reported with MKSANITIZER=yes USE_SANITIZER=undefined:

# ifconfig
alc0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ec_capabilities=3<VLAN_MTU,VLAN_HWTAGGING>
        ec_enabled=0
        address: xx:xx:xx:xx:xx:xx
/public/src.git/sbin/ifconfig/af_inet.c:102:34: runtime error: left shift of 16777215 by 8 places cannot be represented in type 'int'
        inet 192.168.0.38/24 broadcast 192.168.0.255 flags 0x0
        inet6 xxxx::xxxx:xxxx:xxxx:xxx%alc0/64 flags 0x0 scopeid 0x1
lo0: flags=0x8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33624
        inet 127.0.0.1/8 flags 0x0
        inet6 ::1/128 flags 0x20<NODAD>
        inet6 fe80::1%lo0/64 flags 0x0 scopeid 0x2

Change shifting left 1 to shifting 1U. This corrects the issue.

        if (cidr < 32) {                /* more than 1 bit in mask */
                /* check for non-contig netmask */
                if ((mask ^ (((1 << cidr) - 1) << (32 - cidr))) != 0) // <- here
                        return -1;      /* noncontig, no pfxlen */
        }

Solution suggested by <uwe>

Sponsored by <The NetBSD Foundation>
2018-06-11 17:45:50 +00:00
..
amrctl Spelling mistake. 2016-09-11 00:52:39 +00:00
apmlabel fix unused variable warnings. 2013-10-19 01:09:58 +00:00
atactl add SMART 249: Total Raw NAND Writes (1GiB units), sourced from 2016-10-04 21:37:46 +00:00
badsect Drop main() prototype. 2016-09-05 01:00:07 +00:00
bioctl Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
brconfig Use the new BRDGGIFS and BRDGRTS cmds which just use ifdrv directly. 2015-06-01 06:15:18 +00:00
canconfig New sentence, new line. Fix typos. More consistent grammar. 2017-05-29 08:46:23 +00:00
ccdconfig Make ccdconfig resolve wedge names. 2014-12-07 10:44:34 +00:00
cgdconfig With the change to use getpass_r the 128 byte passphrase limit no 2018-05-09 20:23:35 +00:00
chkconfig
chown Add EXIT STATUS section. Use Ex. Sort sections. 2017-07-04 06:53:12 +00:00
clri Actually, V6 included clri before 3BSD. 2016-09-12 23:11:50 +00:00
devpubd Document the version devpubd first appeared. 2016-09-11 01:38:00 +00:00
disklabel Add initial support for ARMv8 (AARCH64) (by nisimura@ and ryo@) 2018-04-01 04:35:01 +00:00
dkctl Bump date for previous. 2018-01-07 18:11:35 +00:00
dkscan_bsdlabel use a minimal "struct disk" in userland rather than the full kernel structure. 2017-06-08 22:24:29 +00:00
dmctl Fix typo 2017-06-04 08:34:34 +00:00
dmesg Make timestamp reading code adapt to whatever precision (up to 2018-04-14 01:37:34 +00:00
drvctl Revert functional changes in previous, at expense of strict KNF conformance. 2018-02-14 17:43:09 +00:00
dump dump was there from v4. 2016-08-15 00:03:14 +00:00
dump_lfs s/filesystem/file system/ 2017-06-07 15:24:50 +00:00
fastboot
fdisk Really don't include ioctl code for tools build. 2017-10-02 22:02:05 +00:00
fsck file system police. 2016-09-11 09:09:54 +00:00
fsck_ext2fs Fix previous properly (wrong variable was tested) thanks riastradh@ 2017-04-21 19:33:56 +00:00
fsck_ffs Restore the MKGROFF=bo MKCXX=yes build 2018-06-11 14:18:16 +00:00
fsck_lfs PR/51418: Jose Luis Rodriguez Garcia: Fix incore src/sbin/fsck_lfs/bufcache.c 2018-03-30 12:56:46 +00:00
fsck_msdos Typos. 2018-02-08 09:05:16 +00:00
fsck_v7fs need <sys/stat.h> 2017-01-10 20:53:09 +00:00
fsdb Fix punctuation markup. 2017-08-05 20:25:41 +00:00
fsirand Document author and the version fsirand appeared. 2016-09-11 21:22:18 +00:00
gpt Spello. (it is "existence"). 2018-05-01 21:16:02 +00:00
ifconfig Correct Undefined Behavior in ifconfig(8) 2018-06-11 17:45:50 +00:00
init init first appeared in V1 UNIX 2016-09-11 22:22:57 +00:00
iscsictl update client OS version as well 2015-08-30 10:49:57 +00:00
iscsid Add printf-like annotation. 2016-05-30 22:02:41 +00:00
ldconfig Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
luactl Direct reader to intro(9lua), lua(9) does not exist. 2017-04-10 19:49:39 +00:00
mbrlabel Handle sector sizes != 512, check partition overlaps, improve guessing 2018-03-30 13:14:25 +00:00
mknod Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
modload Fix Dt argument. 2017-07-18 19:50:54 +00:00
modstat Add a description for the new MODULE_CLASS_BUFQ class. 2016-11-16 10:43:37 +00:00
modunload Use standard section header. 2016-09-12 06:55:10 +00:00
mount Sort SEE ALSO. 2018-01-09 09:15:57 +00:00
mount_ados
mount_autofs It's not literal "-options" so use .Ar 2018-01-24 12:04:47 +00:00
mount_cd9660 s/filesystem/file system/ 2017-06-07 15:24:50 +00:00
mount_chfs Document the version mount_chfs appeared. 2016-09-12 00:38:42 +00:00
mount_efs De-capitalize `.Nd' macro argument. 2013-05-29 14:56:19 +00:00
mount_ext2fs Add MOPT_{REL,NO}ATIME as supported by the underlying filesystems. 2016-02-21 22:51:29 +00:00
mount_fdesc Add crossreference to fd(4) as noted a while back in PR 45694. Bump date. 2013-12-30 08:43:22 +00:00
mount_ffs
mount_filecore
mount_hfs Drop main() prototype. 2016-09-05 01:00:07 +00:00
mount_kernfs
mount_lfs Add MOPT_{REL,NO}ATIME as supported by the underlying filesystems. 2016-02-21 22:51:29 +00:00
mount_msdos Whilst mount_pcfs originated as a patch in 386BSD, NetBSD 0.8 actually was the first release of an OS to ship with it. 2016-10-11 16:10:03 +00:00
mount_nfs Remove Tn for standard abbreviations. 2018-05-17 06:37:06 +00:00
mount_nilfs Sort SEE ALSO. New sentence, new line. Punctuation nits. Use Nx. 2016-06-01 12:01:21 +00:00
mount_ntfs Use Xr instead of Fn to refer readdir(3) 2017-04-15 10:30:55 +00:00
mount_null Eliminate the distinct path check, since the paths don't actually need to be 2016-07-25 04:40:51 +00:00
mount_overlay
mount_portal Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
mount_procfs Bump date for previous. 2017-08-28 05:58:08 +00:00
mount_ptyfs Drop main() prototype. 2016-09-05 01:00:07 +00:00
mount_puffs New sentence, new line. Sort SEE ALSO. Fix typo. 2016-11-24 12:38:32 +00:00
mount_qemufwcfg Sync (dead) usage with man page. 2017-11-30 15:42:18 +00:00
mount_sysvbfs Add AUTHORS section. 2016-09-12 02:38:31 +00:00
mount_tmpfs Add MOPT_{REL,NO}ATIME as supported by the underlying filesystems. 2016-02-21 22:51:29 +00:00
mount_udf Add HISTORY & AUTHORS section. 2016-09-12 02:45:07 +00:00
mount_umap
mount_union s/filesystem/file system/ 2017-06-07 15:24:50 +00:00
mount_v7fs Add HISTORY & AUTHORS section. 2016-09-12 02:57:09 +00:00
newbtconf Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
newfs Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
newfs_ext2fs Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
newfs_lfs Enable the creation of lfs64 volumes. 2015-10-15 06:24:33 +00:00
newfs_msdos updates for GCC 6.4: 2018-02-04 09:03:23 +00:00
newfs_sysvbfs fix includes, addr __RCSID 2017-01-10 20:49:20 +00:00
newfs_udf Disable a couple of warnings until further investigation. 2017-01-11 12:19:43 +00:00
newfs_v7fs need <sys/stat.h> 2017-01-10 20:53:09 +00:00
nologin Mention author in AUTHORS section. 2016-09-12 05:23:32 +00:00
nvmectl nvmectl(8): Remove some wdc subcommands from man page. 2018-04-18 10:17:54 +00:00
ping un-ifdef sgi. NFC 2017-10-02 10:08:11 +00:00
ping6 Add code 3 of paramprob, part of RFC7112: "IPv6 First Fragment has 2018-04-24 07:22:32 +00:00
pppoectl pppoectl first appeared in NetBSD 1.6. 2016-09-12 05:35:20 +00:00
raidctl Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and 2018-03-24 19:41:35 +00:00
rcorder Drop main() prototype. 2016-09-05 01:00:07 +00:00
reboot A standalone reboot utility showed up in 4.0BSD. 2016-09-12 05:43:15 +00:00
resize_ffs Fix computation of left-over fragments also for ufs2. 2017-10-09 05:24:26 +00:00
resize_lfs Add a (draft) 64-bit superblock. Make things build again. 2015-08-02 18:18:09 +00:00
restore Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
rndctl Use <sys/rndio.h> instead of <sys/rnd.h>. 2015-04-13 22:18:50 +00:00
route Handle the routing socket overflowing gracefully. 2018-03-23 11:57:33 +00:00
routed update for GCC 6: 2018-02-06 09:33:07 +00:00
savecore Adapt funopen(3) call after switch to new zlib(3) 2017-01-10 04:42:20 +00:00
scan_ffs Teach scan_ffs about lfs64. 2015-10-15 06:25:23 +00:00
scsictl Fix format. 2017-03-08 11:45:14 +00:00
setkey
shutdown Use NULL instead of 0 for null pointer. 2017-08-07 22:08:12 +00:00
slattach attach tty line discipline by name, not by number. remove unused case value. lgtm christos 2013-10-20 20:17:52 +00:00
svhlabel
swapctl Minor formatting change in swapctl -l as noted in my PR bin/51155 2016-05-31 09:34:25 +00:00
sysctl updates for GCC 6.4: 2018-02-04 09:03:23 +00:00
ttyflags open the tty with O_RDWR|O_NONBLOCK. it seems valid to ask for 2014-05-04 20:43:30 +00:00
tunefs Use getfsspecname also when not found in /etc/fstab. 2015-08-26 05:41:20 +00:00
umount s/filesystem/file system/ 2017-06-07 15:24:50 +00:00
veriexecctl Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
wdogctl Use _PATH_WATCHDOG from <paths.h> instead of locally-defined value. 2015-05-06 23:08:30 +00:00
wsconsctl
Makefile Add mount_autofs 2018-01-14 22:44:04 +00:00
Makefile.inc