Commit Graph

10 Commits

Author SHA1 Message Date
Pedro F. Giffuni
fee1489eb1 libc: fix cases of undefined behavior.
These were found by the Undefined Behavious  GsoC project at NetBSD:

Avoid undefined behavior in ftok(3)

Do not change the signedness bit with a left shift operation.
Cast to unsigned integer to prevent this.

ftok.c:56:10, left shift of 123456789 by 24 places cannot be represented
in type 'int'
ftok.c:56:10, left shift of 4160 by 24 places cannot be represented in
type 'int'

Avoid undefined behavior in an inet_addr.c

Do not change the signedness bit with a left shift operation.
Cast to unsigned integer to prevent this.

inet_addr.c:218:20, left shift of 131 by 24 places cannot be represented
in type 'int'

Detected with micro-UBSan in the user mode.

Obtained from:	NetBSD
MFC after:	2 weeks
2018-08-07 15:24:19 +00:00
Pedro F. Giffuni
d915a14ef0 libc: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-25 17:12:48 +00:00
Craig Rodrigues
55b6b759c8 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:23:16 +00:00
Tim J. Robbins
95a535af6d Change the signature of ftok from (const char *, char) to (const char *, int)
Obtained from:	NetBSD (christos)
2004-06-01 06:53:07 +00:00
David E. O'Brien
ea8d448a92 Fix SCM ID's. 2002-02-01 00:57:29 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
John Polstra
363e8996d7 This is a null commit to log the fact that I have done a repository
copy to bring these files into libc from libcompat.  I will enable
them and kill off the libcompat versions on the main branch soon.

PR:		step one toward closing misc/6763
1998-06-10 04:24:21 +00:00
Peter Wemm
7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Joerg Wunsch
85c30cfa12 Added function and man page for ftok(3), used in conjunction with
the so-called "System V IPC".

Submitted by:	jbeukema@HK.Super.Net (John Beukema)
Obtained from:  Th. Lockert <tholo@sigmasoft.com>, via NetBSD
1995-05-01 08:53:21 +00:00