Tests: Assert the path fits

This commit is contained in:
Sergey Bugaev 2020-08-25 17:48:11 +03:00 committed by Andreas Kling
parent 1cdd798ac7
commit 0106647ab8
Notes: sideshowbarker 2024-07-19 02:59:18 +09:00

View file

@ -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) {