From 2f429e232581c556df4f4bf210aee8a0c99c60b7 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 30 Jan 2017 20:17:30 +0400 Subject: [PATCH] Bump socket buffer size Fix receiving long library paths. --- libglfork.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libglfork.cpp b/libglfork.cpp index 03f514f..ac43142 100644 --- a/libglfork.cpp +++ b/libglfork.cpp @@ -173,11 +173,11 @@ struct EarlyInitializer { strncpy(addr.sun_path, getconf(BUMBLEBEE_SOCKET), sizeof(addr.sun_path)); die_if(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0, "failed to connect to Bumblebee daemon: %s\n", strerror(errno)); - static char c[256]; + static char c[2048]; if (!getenv("PRIMUS_DISPLAY")) { send(sock, "Q VirtualDisplay", strlen("Q VirtualDisplay") + 1, 0); - recv(sock, &c, 255, 0); + recv(sock, &c, sizeof(c) - 1, 0); die_if(memcmp(c, "Value: ", strlen("Value: ")), "unexpected query response\n"); *strchrnul(c, '\n') = 0; *adpy_strp = strdup(c + 7); @@ -185,7 +185,7 @@ struct EarlyInitializer { if (!getenv("PRIMUS_libGLa")) { send(sock, "Q LibraryPath", strlen("Q LibraryPath") + 1, 0); - recv(sock, &c, 255, 0); + recv(sock, &c, sizeof(c) - 1, 0); die_if(memcmp(c, "Value: ", strlen("Value: ")), "unexpected query response\n"); *strchrnul(c, '\n') = 0; int npaths = 0; @@ -202,7 +202,7 @@ struct EarlyInitializer { } } send(sock, "C", 1, 0); - recv(sock, &c, 255, 0); + recv(sock, &c, sizeof(c) - 1, 0); die_if(c[0] == 'N', "Bumblebee daemon reported: %s\n", c + 5); die_if(c[0] != 'Y', "failure contacting Bumblebee daemon\n"); // the socket will be closed when the application quits, then bumblebee will shut down the secondary X