summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-01-13 20:33:33 +0900
committerNobuyoshi Nakada <[email protected]>2024-01-13 23:20:05 +0900
commit9ba2558b76e5b0d871132c38a85055c4746c34de (patch)
tree36e1375ccd5d10ade54b6f215ebeaec5d6c0f78d /ruby.c
parentccd45a1399a9eed7c59120874d0d37bd3ce9d73d (diff)
Fix possible out-of-bounds access
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ruby.c b/ruby.c
index a5794199ec..16db56bd62 100644
--- a/ruby.c
+++ b/ruby.c
@@ -2487,7 +2487,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
static void
warn_cr_in_shebang(const char *str, long len)
{
- if (str[len-1] == '\n' && str[len-2] == '\r') {
+ if (len > 1 && str[len-1] == '\n' && str[len-2] == '\r') {
rb_warn("shebang line ending with \\r may cause problems");
}
}