]> the.earth.li Git - onak.git/blobdiff - keyd.c
Add ability to drop overly large packets
[onak.git] / keyd.c
diff --git a/keyd.c b/keyd.c
index c1c2d5080d280d30b3e6f9f83db7a533e5f58d2a..68f72370b5e04390ccbbc1515f242a1e7e124b49 100644 (file)
--- a/keyd.c
+++ b/keyd.c
  * more details.
  *
  * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 #include <errno.h>
 #include <fcntl.h>
 #include <getopt.h>
+#include <inttypes.h>
 #include <signal.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -609,7 +610,7 @@ int main(int argc, char *argv[])
 {
        int fd = -1, maxfd, i, clients[MAX_CLIENTS];
        fd_set rfds = { 0 }; /* Avoid scan-build false report for FD_SET */
-       char sockname[1024];
+       char sockname[100];
        char *configfile = NULL;
        bool foreground = false;
        int optchar;
@@ -655,7 +656,8 @@ int main(int argc, char *argv[])
        }
        stats->started = time(NULL);
 
-       snprintf(sockname, 1023, "%s/%s", config.sock_dir, KEYD_SOCKET);
+       snprintf(sockname, sizeof(sockname) - 1, "%s/%s",
+                       config.sock_dir, KEYD_SOCKET);
        fd = sock_init(sockname);
 
        if (fd != -1) {