zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2k stars 592 forks source link

Incorrect RSTRING_PTR usage in Ruby mapping #2342

Closed bernardnormier closed 2 days ago

bernardnormier commented 5 days ago

Is this usage of RSTRING_PTR correct? RSTRING_PTR returns a pointer to the Ruby-allocated memory for the string, and the previous usage is indeed suspicious because the documentation states that the returned string is not guaranteed to be null-terminated.

The correct usage would be:

string(RSTRING_PTR(path), RSTRING_LEN(path))

_Originally posted by @pepone in https://github.com/zeroc-ice/ice/pull/2340#discussion_r1652302932_