--- a/src/prototypes.h
+++ b/src/prototypes.h
@@ -559,7 +559,7 @@ extern GETNAMEINFO s_getnameinfo;
 
 #endif /* USE_WIN32 */
 
-int getnameinfo(const struct sockaddr *, int, char *, int, char *, int, int);
+int getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, unsigned int);
 
 #endif /* !defined HAVE_GETNAMEINFO */
 
--- a/src/resolver.c
+++ b/src/resolver.c
@@ -535,8 +535,9 @@ const char *s_gai_strerror(int err) {
 /* implementation is limited to functionality needed by stunnel */
 
 #ifndef HAVE_GETNAMEINFO
-int getnameinfo(const struct sockaddr *sa, int salen,
-    char *host, int hostlen, char *serv, int servlen, int flags) {
+int getnameinfo(const struct sockaddr *sa, socklen_t salen,
+    char *host, socklen_t hostlen, char *serv, socklen_t servlen,
+    unsigned int flags) {
 
 #if defined(USE_WIN32) && !defined(_WIN32_WCE)
     if(s_getnameinfo)
