Commit Graph

20912 Commits

Author SHA1 Message Date
rin 916b154777 libkvm: whitespace 2023-08-23 14:00:11 +00:00
rin 6c2fafb153 libexecinfo: whitespace, missing RCSID, no binary changes 2023-08-23 12:24:59 +00:00
rin c0141d3aff lib/Makefile: Hook libgmp also for MKGDB=yes build
Now, gdb 13 can be built by clang, at least on amd64.
2023-08-20 02:07:54 +00:00
andvar e616cf290c s/logigally/logically/. 2023-08-17 14:21:18 +00:00
rin 12ff6354c6 libcrypt: trailing white space 2023-08-14 02:22:35 +00:00
riastradh 03840421c9 vis(3): Per KNF, sys/param.h comes before sys/types.h.
Which is nice because that's also lexicographic.
2023-08-13 15:20:37 +00:00
riastradh dbb433e7d2 vis(3): Need <stdint.h> for SIZE_MAX, per C standard.
From Kyle Evans <kevans@FreeBSD.org>.

Followup to PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-13 15:19:24 +00:00
riastradh 5f1a044720 vis(3): Sort includes. No functional change intended.
Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-13 15:19:13 +00:00
riastradh 45c2d29183 strncpy(3): More on how strlcpy is not a safe strncpy replacement. 2023-08-13 11:27:22 +00:00
wiz dde43aa723 memcpy: consistency in prototype and fix sentence 2023-08-13 04:20:07 +00:00
riastradh 8a22324f3b vis(3): Fix one more buffer overrun in an edge case.
PR lib/57573

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:48:52 +00:00
riastradh 6d340e9776 vis(3): Fix main part of PR lib/57573.
From Kyle Evans <kevans@FreeBSD.org>.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:48:37 +00:00
riastradh c0d7be47dd vis(3): Avoid potential arithmetic overflow in maxolen.
Can't easily prove that this overflow is impossible, so let's add a
check.

Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:48:17 +00:00
riastradh 5bc0959c19 vis(3): Call wcslen(start) only once.
It had better not change between these two times!

Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:48:01 +00:00
riastradh 4476814b92 vis(3): Avoid arithmetic overflow before calloc(3).
Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:47:17 +00:00
riastradh 0da31b0324 vis(3): Make mbslength unsigned.
Sprinkle assertions and comments justifying the proposition that it
would never go negative if signed.

Obviates need to worry about mblength > SSIZE_MAX.

Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:46:50 +00:00
riastradh 292538aef5 vis(3): Make maxolen unsigned size_t, not ssize_t.
It is initialized once either to *dlen, which is unsigned size_t, or
to wcslen(start) * MB_MAX_LEN + 1, and wcslen returns unsigned size_t
too.  So there appears to have never been any reason for this to be
signed.

Part of PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:46:33 +00:00
riastradh 8663f611f9 strncpy(3): Fix column sizing. 2023-08-11 21:32:26 +00:00
riastradh f9ab7ea1fa strlcpy(3): Tweak markup. 2023-08-11 21:30:32 +00:00
riastradh 1e1d50bc3a strlcpy(3), strncpy(3): Omit needless (void) casts in examples.
The return values are not critical.
2023-08-11 21:20:39 +00:00
riastradh 13b8c448a3 strcpy(3), strlcpy(3), strncpy(3): Just say `byte', not `character'. 2023-08-11 21:17:16 +00:00
riastradh 312767bb97 strncpy(3): Tiny wording tweak. 2023-08-11 21:12:10 +00:00
riastradh 59f2c9f1d8 strncpy(3): Reword to make sentence structure parallel. 2023-08-11 21:11:21 +00:00
riastradh 0c12668de1 strncpy(3): Fix typo -- stpncpy, not stpcpy which is different. 2023-08-11 21:10:26 +00:00
riastradh 71bfa8b23f strncpy(3): Take another whack at clarifying this.
Emphasize the fixed-buffer nature of it, and that NUL-termination is
neither required on input nor guaranteed on output.
2023-08-11 21:09:11 +00:00
riastradh f6905a9fb3 strlcpy(3): Nix stray space between `NUL' and `-terminating'. 2023-08-11 16:34:28 +00:00
uwe cfbafd895b strlcpy(3): don't use \*[Ge] for >= - it's wrong for source code
In the PostScript output it produces the single mathematical "greater
or equal" symbol, not the ">=".
2023-08-11 16:06:10 +00:00
riastradh 86913c27a1 strcpy(3): Note that strlcpy(3) is a safer replacement for strcpy(3).
Suggest snprintf("%s") as a more portable alternative too.

Note that both strlcpy and snprintf still require the input to be
NUL-terminated.
2023-08-11 16:05:56 +00:00
riastradh 8d073134df strncpy(3): Rework the example in an attempt to improve exposition. 2023-08-11 16:04:25 +00:00
riastradh 970f82730a strncpy(3): Note strcpy(3) man page revision this forked from. 2023-08-11 15:37:55 +00:00
riastradh 79c9375f5b strcpy(3), strlcpy(3), strncpy(3): Use `.Tn NUL' for the zero byte.
Let's be consistent within these man pages.  (If someone else really
likes the unpronounceable `.Ql \e0' better, that's fine, you can go
through and systematically change all the man pages to use that after
we're done clarifying strcpy(3), strncpy(3), and strlcpy(3).)
2023-08-11 15:36:17 +00:00
uwe 21d6631bb6 strncpy(3): markup tweaks
NUL is a character name, not a defined name, use .Tn
.Ns has implicit .No effect
Use \*q for ASCII quotes (.Dq uses fancy typographical ones)
2023-08-11 13:18:24 +00:00
uwe ea622231f9 strncpy(3): use .Sm off/on around a fancy expression to avoid lots of Ns 2023-08-11 13:10:59 +00:00
ryoon 7bd94317cb Install strncpy.3 to fix build 2023-08-11 13:07:17 +00:00
riastradh dfb89f3791 strncpy(3): Slightly more consistency about NUL vs '\0' in the text. 2023-08-11 12:26:59 +00:00
riastradh 6a5dfcb3ba strncpy(3): Qualify example of strlcpy(3) with a major caveat. 2023-08-11 11:51:54 +00:00
riastradh d3fccc7122 strncpy(3), stpncpy(3): Split man page out of strcpy(3), stpcpy(3).
These are for substantively different purposes (fixed-width fields
with optional NUL padding vs NUL-terminated strings), so they don't
belong together.

Be more specific about the security issues.
2023-08-11 09:39:39 +00:00
riastradh f69a667415 strlcpy(3): Rework man page to clarify relation to strncpy(3).
Add caveats explaining when strlcpy(3) and strlcat(3) are dangerously
inadequate or inappropriate.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-11 08:15:30 +00:00
mrg 45c979d21c remove the -O0 force for _int_strtod_l() and GCC 9, it's fixed in GCC 10 and 12.
this was triggering sh3 GCC 12 to fail compiles because of ssp.h's memcpy()
frontend having the always_inline attribute that didn't match -O0 or so.

tested with pkgsrc gcc9 to confirm it hangs there, but newer versions are fine.

also known as PR#55668, which now has a real fix (gcc 10 :-).
2023-08-11 06:02:46 +00:00
mrg aec4d439cd avoid various use-after-free issues.
create a ptrdiff_t offset between the start of an allocation region and
some interesting pointer, so it can be adjusted with this offset after
realloc() returns.

found by GCC 12.
2023-08-10 20:38:00 +00:00
riastradh 33ce193df2 libc/resolv/res_debug.c: Minor whitespace fixes. 2023-08-09 07:01:09 +00:00
riastradh b3b6b684eb libnpf(3): No need for weird padding any more.
cdbw_output never needed it at runtime, and the declaration no longer
makes gcc angry about not having it.
2023-08-08 10:36:04 +00:00
riastradh 72254be91c cdbw(3): Make cdbw_output descr parameter type less confusing.
This is a string of _up to_ 16 bytes, used with strncpy(..., 16).
Specifying `const char descr[16]', while formally equivalent to
`const char *descr' in standard C, now provokes the ire of gcc when
the caller does not provide a buffer of at least 16 bytes.
2023-08-08 10:34:08 +00:00
mrg 195e7a0895 avoid uninitialised variable accesses.
if __kernel_rem_pio2() or __kernel_rem_pio2f() are called with "nx" less
than 2, the local variable fq[0] may be accessed uninitialised.

__kernel_rem_pio2() has direct calls with nx = 1, and __kernel_rem_pio2f()
is called with a value starting at 3, but may be decreased to less than 2,
implied by this code , if not actually avoided by the tx[] setup above:
	nx = 3;
	while(tx[nx-1]==zero) nx--;     /* skip zero term */
	n  =  __kernel_rem_pio2f(tx,y,e0,nx,2,two_over_pi);

found by GCC 12.
2023-08-08 06:31:17 +00:00
rin 54684bbd74 libm: Add fma(3) and friends to m68k 2023-08-08 02:09:42 +00:00
riastradh a8b57fa134 libm: Add dummy remainderl and remquol.
These are pretty bad -- these aren't transcendental functions; not
rocket science to make them correctly rounded -- but let's just make
sure they're available in libm for netbsd-10.

XXX pullup-10
2023-08-07 08:54:40 +00:00
andvar 506971ff58 fix typos in comments and one definition, mainly s/sucket/socket/. 2023-08-03 20:45:49 +00:00
rin 03675fcefd Revert CC_WNO_USE_AFTER_FREE from Makefile's (thanks uwe@) 2023-08-03 14:56:36 +00:00
rin 91f8ac6d30 Sprinkle CC_WNO_USE_AFTER_FREE for GCC 12
All of them are blamed for idiom equivalent to:
	newbuf = realloc(buf, size);
	p = newbuf + (p - buf);
2023-08-03 13:36:08 +00:00
nia e6ea867424 Revert addition of epoll to libc until discussion concludes 2023-08-03 12:24:46 +00:00