This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Dan Cross 931c5625a3 Get rid of strncpy() calls.
The poorly named `strncpy` was originally written to
copy data into fixed-sized, disk-resident data structures
in an early version of the research Unix kernel.  Thus, it
has peculiar semantics: it takes source and destination
pointer arguments and a length and will *always* modify
exactly `length` bytes in the destination buffer.  If
the length of the source (which is presumed to be a
NUL-terminated C-stylestring) is `length` or more chars
long, then the result will not be NUL terminated.  If it
is less than `length` bytes long, then the result will be
padded with zeros up to `length`.

This is all well and good for storing a file name into a
fixed-width directory entry in 6th edition Unix, but it's
not useful as a general-purpose string utility.

Replaced with calls to strlcpy(), which always properly
terminates the destination but doesn't have the additional
zeroing behavior.  Since the buffers that we're copying
into were allocated with malloz(), and thus are guaranteed
to be filled with zeros, we're not leaking data, but not
double-zeroing either.

A few other things were changed. Lengths of destination
buffers are now given via `sizeof` instead of manifest
constants.  One call to `memcpy` took the length from the
size of the source argument, thus possibly writing beyond
the end of the destination buffer.  Changed to a call to
strlcpy() with length the sizeof destination.

Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
2018-10-16 10:59:53 +10:00
deps Final fix for dragonfly 2018-10-12 18:13:37 +10:00
dist some fixes for area selection and message list header 2018-10-13 20:03:58 +10:00
docs documentation work and a bug fix 2018-08-13 14:07:21 +10:00
src Get rid of strncpy() calls. 2018-10-16 10:59:53 +10:00
utils Makefile tweaks for sunos and macos 2018-10-12 15:58:29 +10:00
.gitignore Start on qwknet support 2018-06-24 10:28:18 +10:00
.gitlab-ci.yml put -qq back in 2018-03-05 18:49:30 +10:00
.gitmodules Update git modules 2018-06-05 14:03:18 +10:00
file_id.diz Change file_id.diz to test post-receive hook 2018-10-15 14:51:37 +10:00
GNUmakefile Trivial whitespace cleanups 2018-10-11 21:36:35 +10:00
LICENSE.txt Added License & FILE_ID.DIZ 2016-04-09 18:22:55 +10:00
README.md Updated Documentation 2018-02-05 11:14:37 +10:00
setup.sh Trivial whitespace cleanups 2018-10-11 21:36:35 +10:00
STRINGS.CHANGES Fix for random crap at the end of messages 2018-10-14 22:27:27 +10:00

MagickaBBS

A Bulletin Board System for UN*X like platforms.

For documentation, see http://docs.magickabbs.com/