String manipulations used in libssh.
More...
String manipulations used in libssh.
◆ ssh_string_burn()
Destroy the data in a string so it couldn't appear in a core dump.
- Parameters
-
◆ ssh_string_copy()
Copy a string, return a newly allocated string. The caller has to free the string.
- Parameters
-
- Returns
- Newly allocated copy of the string, NULL on error.
◆ ssh_string_data()
Get the payload of the string.
- Parameters
-
s | The string to get the data from. |
- Returns
- Return the data of the string or NULL on error.
◆ ssh_string_fill()
Fill a string with given data. The string should be big enough.
- Parameters
-
s | An allocated string to fill with data. |
data | The data to fill the string with. |
len | Size of data. |
- Returns
- 0 on success, < 0 on error.
◆ ssh_string_free()
Deallocate a SSH string object.
- Parameters
-
[in] | s | The SSH string to delete. |
◆ ssh_string_free_char()
void ssh_string_free_char |
( |
char * | s | ) |
|
Deallocate a char string object.
- Parameters
-
[in] | s | The string to delete. |
◆ ssh_string_from_char()
Create a ssh string using a C string.
- Parameters
-
[in] | what | The source 0-terminated C string. |
- Returns
- The newly allocated string, NULL on error with errno set.
- Note
- The null byte is not copied nor counted in the output string.
◆ ssh_string_get_char()
Get the string as a C null-terminated string.
This is only available as long as the SSH string exists.
- Parameters
-
[in] | s | The SSH string to get the C string from. |
- Returns
- The char pointer, NULL on error.
◆ ssh_string_len()
Return the size of a SSH string.
- Parameters
-
[in] | s | The input SSH string. |
- Returns
- The size of the content of the string, 0 on error.
◆ ssh_string_new()
Create a new SSH String object.
- Parameters
-
[in] | size | The size of the string. |
- Returns
- The newly allocated string, NULL on error.
◆ ssh_string_to_char()
Convert a SSH string to a C null-terminated string.
- Parameters
-
[in] | s | The SSH input string. |
- Returns
- An allocated string pointer, NULL on error with errno set.
- Note
- If the input SSH string contains zeroes, some parts of the output string may not be readable with regular libc functions.