mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
. Fix chomp()'s checking of empty strings.
This commit is contained in:
parent
c58880c10a
commit
7df4b55839
@ -788,8 +788,9 @@ static char *read_line(FILE *fp)
|
||||
*/
|
||||
static void chomp(char *str)
|
||||
{
|
||||
size_t pos = strlen(str) - 1;
|
||||
if ((pos >= 0) && (str[pos] == '\n')) str[pos] = '\0';
|
||||
size_t len = strlen(str);
|
||||
if (len == 0) return;
|
||||
if (str[len-1] == '\n') str[len-1] = '\0';
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user