summaryrefslogtreecommitdiff
path: root/ext/socket/raddrinfo.c
diff options
context:
space:
mode:
authorYusuke Endoh <[email protected]>2024-11-14 08:34:24 -0600
committerYusuke Endoh <[email protected]>2024-11-14 11:29:47 -0600
commit4074c6b427ff53fc9e3dbffcd2792e5dd8b3a7ef ()
treed790e9431922818f4452d3bb508f9b21b41a4582 /ext/socket/raddrinfo.c
parent7e2f9eaccd008e1ef91411145112f5820a05580b (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: Merged: https://.com/ruby/ruby/pull/12089
-rw-r--r--ext/socket/raddrinfo.c2
1 files changed, 1 insertions, 1 deletions
@@ -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, &notification, strlen(&notification))) < 0) {
entry->err = errno;
entry->has_syserr = true;
}