diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-08-25 17:48:11 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-30 17:35:27 +0200 |
commit | 0106647ab8b6dd016e362a16ef35ded949125cf3 (patch) | |
tree | 06a3d12d39f32c528aaae55c69b6527da677be3c /Userland | |
parent | 1cdd798ac7b7be2d0fddb7e858828310c25723f0 (diff) | |
download | serenity-0106647ab8b6dd016e362a16ef35ded949125cf3.zip |
Tests: Assert the path fits
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp b/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp index a25c9c8962..1f9fb5003a 100644 --- a/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp +++ b/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <AK/Assertions.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> @@ -47,7 +48,7 @@ int main(int, char**) struct sockaddr_un addr; memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; - strlcpy(addr.sun_path, path, sizeof(addr.sun_path)); + ASSERT(strlcpy(addr.sun_path, path, sizeof(addr.sun_path)) < sizeof(addr.sun_path)); rc = bind(fd, (struct sockaddr*)(&addr), sizeof(addr)); if (rc < 0 && errno == EADDRINUSE) { |