diff --git a/upnp/src/inc/upnputil.h b/upnp/src/inc/upnputil.h
index 2f18422b..ffc79254 100644
--- a/upnp/src/inc/upnputil.h
+++ b/upnp/src/inc/upnputil.h
@@ -106,7 +106,7 @@ void linecopylen(
 		#endif
 		#define sleep(a) Sleep((a)*1000)
 		#define usleep(a) Sleep((a) / 1000)
-		#define strerror_r(a, b, c) (strerror_s((b), (c), (a)))
+		#define strerror_r(a, b, c) strncpy(b, strerror(a), c)
 	#else
 		#define max(a, b) (((a) > (b)) ? (a) : (b))
 		#define min(a, b) (((a) < (b)) ? (a) : (b))
