tcp_cmd
fix tcp_cmd_remove_leading_space if str is null
This commit is contained in:
@@ -76,6 +76,9 @@ void tcp_cmd_remove_newline(char* str, size_t len) {
|
||||
|
||||
char* tcp_cmd_remove_leading_space(char* str, size_t len) {
|
||||
size_t i = 0;
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
while (str[i] != '\0' && i < len) {
|
||||
if (isspace((int)str[i]) == 0) {
|
||||
return &str[i];
|
||||
|
||||
Reference in New Issue
Block a user