You are right. `while (p > *value && isspace(p) --p;` will lost a character of the value, such as `{'F', 'r', 'o', 'm', ' ', ' ', '\r', ' ', 'v', '\r', '\0'}`.
This is a test string with value_len less than 0, `{'F', 'r', 'o', 'm', ' ', ' ', '\r', ' ', '\r', '\n', '\0'}`