aboutsummaryrefslogtreecommitdiffstats
path: root/dist-tools
Commit message (Expand)AuthorAgeFilesLines
* dist-tools/getstats.py - make this Python 3...Matthias Andree2020-02-141-14/+19
* Fix URL, and use a new $uploaddir variable.Matthias Andree2020-01-211-2/+3
* Commit what has gone into 6.4.2-rc1.Matthias Andree2020-01-201-2/+4
* Do not unlink release notes from autobuild/README.Matthias Andree2019-09-281-1/+1
* Decode .po's author name to locale according to Content-Type header.Matthias Andree2019-09-051-8/+14
* dist-tools/git-commit-po-updates.sh updatesMatthias Andree2019-09-021-2/+26
* Helper script to commit PO updates to Git.Matthias Andree2019-08-261-0/+43
* Align with legacy_6x.Matthias Andree2019-08-251-1/+1
* Suspend pushing to local public_html.Matthias Andree2019-08-241-1/+1
* Misc. updates to makerelease.pl.Matthias Andree2019-05-141-4/+2
* Permit beta builds.Matthias Andree2018-06-211-1/+1
* Avoid deprecated regexps in manServer.plMatthias Andree2017-04-221-3/+3
* More berlios -> sourceforge changes.Matthias Andree2014-05-212-2/+2
* Convert most references from berlios.de to sourceforge.net.Matthias Andree2014-05-212-8/+3
* Sign .xz; upload to sf.net; upload .xz to local site.Matthias Andree2012-12-231-3/+25
* Remove LSM-related stuff from the distribution.Matthias Andree2012-12-231-5/+1
* Get ready for 6.3.22 release.Matthias Andree2012-08-291-1/+1
* Drop vendor-sec@lst.de, defunct.Matthias Andree2011-08-161-2/+1
* Add send-erratum-notice.sh dist-tool script.Matthias Andree2010-10-161-0/+11
* Find an.tmac definitions on FreeBSD 8.1.Matthias Andree2010-10-121-0/+1
* Release 6.3.16.Matthias Andree2010-04-061-31/+69
* Update for 6.3.15 release.Matthias Andree2010-03-282-57/+44
* Update documents/scripts after SVN -> Git move.Matthias Andree2010-02-063-2/+7
* Getting ready for 6.3.14 release.Matthias Andree2010-02-051-7/+9
* Clean up dist-tools, remove or update.Matthias Andree2009-10-3010-780/+29
* Update.Matthias Andree2009-08-061-8/+7
* Add security announcer script.Matthias Andree2008-06-171-0/+16
* Block this script.Matthias Andree2006-11-221-1/+4
* Block this script.Matthias Andree2006-11-221-0/+3
* Revise a bunch of links.Matthias Andree2006-03-311-3/+6
* Add a few revisions (not yet workable).Matthias Andree2005-11-271-7/+7
* Override LC_ALL so that a parsable Date results.Matthias Andree2005-07-101-6/+9
* Skip list subscriber counts.Matthias Andree2005-07-101-4/+6
* Pull out important configuration to the head of the script.Matthias Andree2005-07-101-6/+15
* Update links to fetchmail home page.Matthias Andree2005-04-271-1/+1
* Print time in UTC (GMT) and override locale to C.Matthias Andree2005-04-271-1/+1
* Change: use SVN rather than RCS to check out codeMatthias Andree2005-04-271-3/+10
* Move the html2txt script to dist-tools.Graham Wilson2004-11-291-0/+49
* Move a handful of scripts (used for releases, testing, etc.) to dist-tools, s...Graham Wilson2004-08-3018-0/+2405
* Try fallback to rpm (in case rpm is version 3).Matthias Andree2004-06-191-1/+2
* Make manServer compatible with modern groff installationsRob Funk2004-06-181-1/+9
* Make manServer.pl executableRob Funk2004-06-181-0/+0
* Move shipper to dist-tools directoryRob Funk2004-06-1811-0/+2462
* Add dist-tools directory, for tools used in creating a distribution.Rob Funk2004-06-181-0/+2927
NUL-terminate the result (as long as .Fa size is larger than 0 or, in the case of .Fn strlcat , as long as there is at least one byte free in .Fa dst ) . Note that you should include a byte for the NUL in .Fa size . Also note that .Fn strlcpy and .Fn strlcat only operate on true .Dq C strings. This means that for .Fn strlcpy .Fa src must be NUL-terminated and for .Fn strlcat both .Fa src and .Fa dst must be NUL-terminated. .Pp The .Fn strlcpy function copies up to .Fa size - 1 characters from the NUL-terminated string .Fa src to .Fa dst , NUL-terminating the result. .Pp The .Fn strlcat function appends the NUL-terminated string .Fa src to the end of .Fa dst . It will append at most .Fa size - strlen(dst) - 1 bytes, NUL-terminating the result. .Sh RETURN VALUES The .Fn strlcpy and .Fn strlcat functions return the total length of the string they tried to create. For .Fn strlcpy that means the length of .Fa src . For .Fn strlcat that means the initial length of .Fa dst plus the length of .Fa src . While this may seem somewhat confusing it was done to make truncation detection simple. .Pp Note however, that if .Fn strlcat traverses .Fa size characters without finding a NUL, the length of the string is considered to be .Fa size and the destination string will not be NUL-terminated (since there was no space for the NUL). This keeps .Fn strlcat from running off the end of a string. In practice this should not happen (as it means that either .Fa size is incorrect or that .Fa dst is not a proper .Dq C string). The check exists to prevent potential security problems in incorrect code. .Sh EXAMPLES The following code fragment illustrates the simple case: .Bd -literal -offset indent char *s, *p, buf[BUFSIZ]; \&... (void)strlcpy(buf, s, sizeof(buf)); (void)strlcat(buf, p, sizeof(buf)); .Ed .Pp To detect truncation, perhaps while building a pathname, something like the following might be used: .Bd -literal -offset indent char *dir, *file, pname[MAXPATHLEN]; \&... if (strlcpy(pname, dir, sizeof(pname)) \*[Ge] sizeof(pname)) goto toolong; if (strlcat(pname, file, sizeof(pname)) \*[Ge] sizeof(pname)) goto toolong; .Ed .Pp Since we know how many characters we copied the first time, we can speed things up a bit by using a copy instead of an append: .Bd -literal -offset indent char *dir, *file, pname[MAXPATHLEN]; size_t n; \&... n = strlcpy(pname, dir, sizeof(pname)); if (n \*[Ge] sizeof(pname)) goto toolong; if (strlcpy(pname + n, file, sizeof(pname) - n) \*[Ge] sizeof(pname) - n) goto toolong; .Ed .Pp However, one may question the validity of such optimizations, as they defeat the whole purpose of .Fn strlcpy and .Fn strlcat . .Sh SEE ALSO .Xr snprintf 3 , .Xr strncat 3 , .Xr strncpy 3 .Sh HISTORY .Fn strlcpy and .Fn strlcat first appeared in .Ox 2.4 , then in .Nx 1.4.3 and .Fx 3.3 .