diff --git a/p11-kit/rpc-server.c b/p11-kit/rpc-server.c
index 3d695a00..ef3b3836 100644
--- a/p11-kit/rpc-server.c
+++ b/p11-kit/rpc-server.c
@@ -55,6 +55,7 @@
 #include <sys/param.h>
 #include <assert.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>