You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by mike-jumper <gi...@git.apache.org> on 2019/01/07 01:51:14 UTC
[GitHub] guacamole-server pull request #209: GUACAMOLE-637: Migrate strncpy(), strcat...
GitHub user mike-jumper opened a pull request:
https://github.com/apache/guacamole-server/pull/209
GUACAMOLE-637: Migrate strncpy(), strcat(), etc. to safer libguac implementations.
This change adds platform-independent libguac implementations of the `strlcpy()` and `strlcat()` functions, `guac_strlcpy()` and `guac_strlcat()`, provided via a new `guacamole/string.h` header. These functions will use the versions provided by the platform's libc, if available.
Unlike `strncpy()` and `strncat()`, the `strlcpy()` and `strlcat()` variants guarantee that the destination buffer is null-terminated, even if the result had to be truncated: https://www.freebsd.org/cgi/man.cgi?query=strlcpy&sektion=3&manpath=FreeBSD+6.2-RELEASE
This change also adds a similar convenience function, `guac_strljoin()`, which provides an implementation of the familiar "join" operation for strings.
Unit tests have been added for each of the new functions.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mike-jumper/guacamole-server string-functions
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/guacamole-server/pull/209.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #209
----
commit a379bdecb76a2956e984292d3d7ab6fa734cf0f1
Author: Michael Jumper <mj...@...>
Date: 2018-10-19T16:30:20Z
GUACAMOLE-637: Use proper namespaced path for Guacamole headers within libguac source.
commit 563990699bb8a6af68bf65f2c768e51df9d272f1
Author: Michael Jumper <mj...@...>
Date: 2018-10-19T16:49:23Z
GUACAMOLE-637: Add strlcpy() implementation. Use libc strlcpy() if available.
commit 4bcab90d0a05024f9b8489b384165ce3759c8489
Author: Michael Jumper <mj...@...>
Date: 2018-10-19T19:28:04Z
GUACAMOLE-637: Add strlcat() implementation. Use libc strlcat() if available.
commit f8e9e5017a738aacd852897d087f3e7b99c7adf5
Author: Michael Jumper <mj...@...>
Date: 2018-10-19T19:28:38Z
GUACAMOLE-637: Add convenience function for joining an array of strings using a given delimiter.
commit c1c7d096738296e2027be8b6ddfecbff61c2c2ac
Author: Michael Jumper <mj...@...>
Date: 2018-11-12T23:19:33Z
GUACAMOLE-637: Replace usages of strncpy() with guac_strlcpy().
commit 3490ffd1d8efbc4fa193b400d4a408ccf55a4c9f
Author: Michael Jumper <mj...@...>
Date: 2018-11-12T23:38:02Z
GUACAMOLE-637: Replace usages of strncat() with guac_strlcat().
commit 143e82c32bd2525be8187f316aa969ae9678c5f4
Author: Michael Jumper <mj...@...>
Date: 2018-11-13T00:10:24Z
GUACAMOLE-637: Simplify path translation logic. Update to use guac_strl*(). Fix return values.
commit 8353ea3e3f3c5643f1929b9e8c554760cb8298f1
Author: Michael Jumper <mj...@...>
Date: 2018-11-19T20:37:24Z
GUACAMOLE-637: Add unit tests for guac_strlcpy().
commit 78dc18eda2e376714ea8bc3b6d1d21b9c1fc8931
Author: Michael Jumper <mj...@...>
Date: 2018-11-20T07:16:22Z
GUACAMOLE-637: Add unit tests for guac_strlcat().
commit c257b8545ac17e1a4bd296f0f76dfe4d42fbfdf8
Author: Michael Jumper <mj...@...>
Date: 2019-01-06T23:03:54Z
GUACAMOLE-637: Correctly handle string lengths as size_t (unsigned).
commit 8732ee0668a2102c4c6fb9a7875892273d9067c0
Author: Michael Jumper <mj...@...>
Date: 2019-01-06T23:26:45Z
GUACAMOLE-637: Add unit tests for guac_strljoin().
----
---