diff options
| author | Yusuke Endoh <mame@ruby-lang.org> | 2024-11-14 08:34:24 -0600 |
|---|---|---|
| committer | Yusuke Endoh <mame@ruby-lang.org> | 2024-11-14 11:29:47 -0600 |
| commit | 4074c6b427ff53fc9e3dbffcd2792e5dd8b3a7ef (patch) | |
| tree | d790e9431922818f4452d3bb508f9b21b41a4582 | |
| parent | 7e2f9eaccd008e1ef91411145112f5820a05580b (diff) | |
Fix a stack-buffer-overflow bug
http://ci.rvm.jp/results/trunk_asan@ruby-sp1/5408428
```
==3159643==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x796cf8f09041 at pc 0x6539bbf68ded bp 0x796cfadffcf0 sp 0x796cfadff4b8
READ of size 2 at 0x796cf8f09041 thread T13
#0 0x6539bbf68dec in strlen (/tmp/ruby/build/trunk_asan/ruby+0x18edec) (BuildId: cca267c7ae091060e1b82a6b4ed1aeaf00edebab)
```
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12089
| -rw-r--r-- | ext/socket/raddrinfo.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index a7cf1211ba..6f81937604 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -3102,7 +3102,7 @@ do_fast_fallback_getaddrinfo(void *ptr) const char notification = entry->family == AF_INET6 ? IPV6_HOSTNAME_RESOLVED : IPV4_HOSTNAME_RESOLVED; - if ((write(shared->notify, ¬ification, strlen(¬ification))) < 0) { + if ((write(shared->notify, ¬ification, 1)) < 0) { entry->err = errno; entry->has_syserr = true; } |
