Skip to content

[Rust] BnString::as_bytes_with_null does not include a nul byte #6784

@bdash

Description

@bdash

Version and Platform (required):

  • Binary Ninja Version: 5.1.7320-dev (aa12054b)
  • OS: macOS 15.4.1
  • CPU Architecture: arm64

Bug Description:
BnString::as_bytes_with_null has no documentation, but based on its name I assumed it would include a trailing NUL. It doesn't. It returns a byte array of the string with the trailing NUL byte removed.

If it intends to include the NUL it should call through to CStr::to_bytes_with_nul rather than CStr::to_bytes.

It wouldn't hurt to update the method name to be consistent with the Rust standard library either (as -> to and null -> nul).

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions