Commit Graph

90 Commits

Author SHA1 Message Date
joerg
f6072d060e Use reallocarr and simplify. Document valid reallocation failures. 2015-02-17 20:30:44 +00:00
christos
a582ce5979 Add and use reallocarray() to prevent a multiplication overflow in allocation.
Reported by Guido Vranken, thanks!
2015-02-05 16:04:35 +00:00
wiz
94a4d029bf Replace dagger ("\(dg") with hash mark ("#") for marking up differences.
Dagger wasn't displayed on terminals and replaced with a minus, which
was hard to read.

Requested by agc.
2013-01-25 11:51:42 +00:00
christos
c5e820cae4 PR/45989: Martin Husemann: lint invocation does include -w only on i386
- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
  would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
  builds)

approved by core@
2012-03-13 21:13:30 +00:00
christos
c8e7a7eec2 if we don't have any sets yet, don't try to look in them. 2011-11-08 19:25:45 +00:00
christos
627cbe00c4 pass lint on i386 2011-10-09 22:14:17 +00:00
christos
407d8594d2 Prevent regcomp/regexec DoS attacks by limiting the amount of memory used
and the level of recursion. Thanks to Maksymilian Arciemowicz for discovery
and help with the implementation.
2011-10-09 18:23:00 +00:00
enami
bde048cc49 Use Pq or Po macro for better output rather than putting raw open paren
at the end of line.
2011-05-17 03:35:38 +00:00
joerg
1c3412fa2f Use .In for header files instead of .Ar Pa and variations. 2010-03-22 19:30:53 +00:00
joerg
c4cbdd8e8a Convert to mdoc markup. 2009-04-21 14:46:02 +00:00
wiz
73bfbb6953 Improve markup. 2009-04-11 16:58:21 +00:00
joerg
0cc93fa086 Use semantic markup. 2009-04-11 15:44:42 +00:00
lukem
64d3d6de80 sign-compare fixes 2009-02-12 05:06:54 +00:00
junyoung
931a89e75c Rearrange headers for better portability. 2007-02-09 23:44:18 +00:00
junyoung
9641e3f094 ANSIfy. 2007-02-08 05:44:18 +00:00
junyoung
19690e9aea Nuke __P. 2007-02-08 05:07:23 +00:00
christos
dcd8e4c853 remove unused label. 2006-03-19 04:43:17 +00:00
christos
def2a8d763 revert previous error check. 2006-03-19 04:17:42 +00:00
christos
2b86a068b9 Coverity CID 769: Avoid NULL deref. 2006-03-19 02:51:30 +00:00
christos
3b66d5d2eb Coverity CID 770: Avoid NULL deref. 2006-03-19 02:48:30 +00:00
yamt
d2e4059844 constify and remove __UNCONST. 2005-12-02 12:12:29 +00:00
christos
03256c6e55 WARNS=4 2005-11-29 03:11:58 +00:00
jdolecek
62b15febd3 make othercase() return int rather than char, to avoid sign extension
bug with character codes >= 128

fixes PR lib/26986 by Alexander Becher
2004-09-18 11:47:37 +00:00
christos
46937c5008 Avoid infinite recursion on:
echo "foo foo bar bar bar baz" | sed 's/\([^ ]*\)\( *\1\)*/\1/g'

From OpenBSD.
2004-04-03 17:00:00 +00:00
enami
d43ce6c183 Redo previous in a different way; cast the character held in int variable
as unsigned char just before passing isalnum() in ISWORD() rather than
fetching it as unsigned char.  It is ok since EOF is never passed to ISWORD()
(though it will be a bit inefficient.)

Addresses PR#24929.
2004-03-26 22:42:17 +00:00
enami
4604becb77 Sprinkle cast to prevent unwanted sign extension. Some of those actually
makes sed invoked during build process an out of bound array access.
2004-03-12 22:34:09 +00:00
wiz
08f5fb02e9 Remove sentence about this being an alpha
version -- after twelve years it is at least beta ;)
The BUGS section is extensive enough even without it.
2003-12-29 17:36:12 +00:00
agc
eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
wiz
472351e13d Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
2003-04-16 13:34:34 +00:00
kleink
d58cfc7d35 Sprinkle some restrict. 2003-02-05 23:13:07 +00:00
itojun
9134efabd0 use strlcpy where it is more appropriate. 2002-11-17 01:51:24 +00:00
wiz
3225ede1d3 New sentence, new line. From Robert Elz. 2002-10-01 17:02:56 +00:00
christos
ce8a71a179 make this compile with -DREDEBUG again. 2002-07-22 12:56:17 +00:00
simonb
eb0846961e Remove <sys/types.h> from synopsis, as per latest SUS/Posix specs. 2002-04-29 01:41:43 +00:00
ross
dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
ross
814f296b77 Generate <>& symbolically. 2002-02-07 07:00:09 +00:00
christos
ecb7b5a99a PR/14975: Takayoshi Kochi: memory leak in regexec(3).
Always free m->pmatch and m->lastpos on error.
2001-12-17 16:32:49 +00:00
christos
74ffc129b3 turn a macro into a simple statement. 2001-12-17 16:31:11 +00:00
wiz
23f84ac4f1 Sort sections and add .Sx in two places. 2001-09-16 02:20:13 +00:00
wiz
fabf44e83f Boring whitespace fix. 2001-09-16 02:19:33 +00:00
jdolecek
30ca1a2a3e add missing ' is ' in regerror() explanation 2000-11-06 13:20:58 +00:00
itohy
7daefc5a5a Passing "char" values to ctype(3) functions is problematic.
If an argument of a ctype function is outside "unsigned char"
and if it is not EOF, the behavior is undefined.

The isascii(3) is the sole exception of above and it was used to
be used to check a value was valid for other ctype functions in
ancient systems.  On modern systems, the ctype functions take
all values of "unsigned char", and this check is obsolete and
even wrong for non-ASCII systems.  However, we leave the isascii()
untouched for now, so as not to change the current behavior.
2000-07-07 08:03:36 +00:00
mycroft
605490369c Delint.
Remove trailing ; from uses of __weak_alias().  The macro inserts this if
needed.
2000-01-22 22:19:07 +00:00
lukem
d896261208 back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
1999-09-20 04:38:56 +00:00
kleink
c46d95a329 The previous assertion change was incorrect: the preg argument is permitted to
be NULL (part of the interface definition!) unless errcode is REG_ATOI, which
is a non-portable extension.

Also, remove assertions from the local regatoi() function, as they are either
redundant or will never fail due to the buffer allocation for that argument in
regerror().
1999-09-17 09:33:34 +00:00
lukem
b48252f365 * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
  and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

		_DIAGASSERT(path != NULL)
	#ifdef _DIAGNOSTIC
		if (path == NULL) {
			errno = EFAULT;
			return (-1);
		}
	#endif
1999-09-16 11:44:54 +00:00
christos
c927d63f09 Avoid overflow when adding a 64 bit quantity to a 32 bit pointer on 32 bit
machines.
1999-01-20 12:58:21 +00:00
drochner
b6581ead5f Minor size_t!=int related cleanup, only effective on the alpha.
btw: the maximum length of an RE is limited by the "int" range, also
on the alpha. "sopno" is "int", and "int"s are used as counters within
the code, so it would need some work to change this. I only don't know
how one could test it...
1998-12-13 12:21:46 +00:00
drochner
7cd4c14e82 regoff_t is used like size_t within the code, it should be defined
so instead of off_t. This makes some casts unnecessary.
We can't change the definition now due to binary compatibility, so
prepare for the next libc major version.
1998-12-08 14:00:24 +00:00
drochner
64a8986fc2 Change some function arguments to appropriate types. This makes lint
happy without casts.
1998-12-08 13:52:48 +00:00