summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-11-23 13:55:15 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-11-23 13:55:15 +0900
commitbeb85e7eeee4163cd45b69645a60cdb942f72c05 (patch)
treed27290773e8a32861c03ebe7801e5201508fb9ff /ext/socket
parenta7f948c32c169ceabb5719f0328e594759c73cd8 (diff)
[Bug #21705] Fix segfaults on Windows
It should check the type of the argument and coercion before converting the encoding.
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/unixsocket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 31e2acee04..2ec9376074 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -42,11 +42,12 @@ unixsock_path_value(VALUE path)
}
}
#endif
+ path = rb_get_path(path);
#ifdef _WIN32
/* UNIXSocket requires UTF-8 per spec. */
path = rb_str_export_to_enc(path, rb_utf8_encoding());
#endif
- return rb_get_path(path);
+ return path;
}
VALUE