Provided by: libelf-dev_0.194-1_amd64 bug

NAME

       elf_strptr - Return a pointer to a string in a string table section

SYNOPSIS

       #include <libelf.h>

       char *elf_strptr(Elf *elf, size_t section_index, size_t offset);

DESCRIPTION

       The  elf_strptr() function returns a pointer to a null-terminated string located at offset bytes from the
       beginning of the string table  section  identified  by  section_index.   The  section  must  be  of  type
       SHT_STRTAB.

       This  function  validates the provided offset against the size of the string table and ensures the string
       is null-terminated. It transparently handles both uncompressed and compressed sections.

       If the ELF descriptor is not backed by memory mapping, or the  section  has  not  been  loaded  yet,  the
       function will read and initialize the necessary data from the file.

PARAMETERS

       elf    Pointer to an ELF descriptor.

       section_index
              The index of the string table section (of type SHT_STRTAB).

       offset The  byte  offset  from  the  beginning  of  the  string table section where the desired string is
              located.

RETURN VALUE

       Returns a pointer to the string within the string table if successful.  Returns NULL on error.

SEE ALSO

       elf(3), elf_getscn(3), libelf(3), elf(5)

ATTRIBUTES

       ┌─────────────────────────────────────────────────────────────────────────────┬───────────────┬─────────┐
       │ InterfaceAttributeValue   │
       ├─────────────────────────────────────────────────────────────────────────────┼───────────────┼─────────┤
       │ elf_strptr()                                                                │ Thread safety │ MT-Safe │
       └─────────────────────────────────────────────────────────────────────────────┴───────────────┴─────────┘

REPORTING BUGS

       Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.

Libelf                                             2025-06-30                                      ELF_STRPTR(3)