diff --git a/src/libjasper/include/jasper/jas_stream.h b/src/libjasper/include/jasper/jas_stream.h
index f947988d7..385855f80 100644
--- a/src/libjasper/include/jasper/jas_stream.h
+++ b/src/libjasper/include/jasper/jas_stream.h
@@ -258,6 +258,10 @@ typedef struct {
 typedef struct {
 	int fd;
 	int flags;
+#ifndef _UCRT
+#undef L_tmpnam
+#define L_tmpnam FILENAME_MAX
+#endif
 #if defined(JAS_WASI_LIBC)
 #define L_tmpnam 4096
 #endif
