Skip to content

Commit

Permalink
base: fix curl log to skip CRLF data
Browse files Browse the repository at this point in the history
To fix crash for CRLF data, skip the data modification if the data is
only include CRLF data.

Signed-off-by: Inho Oh <[email protected]>
  • Loading branch information
webispy authored and kimhyungrok committed Jun 5, 2024
1 parent 6e64095 commit ba6b3d7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/base/nugu_curl_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ static void _network_curl_log(void *req, enum curl_log_type type,
} else {
int flag = 0;

if (size == 2) {
/* Skip '\r\n' */
if (data[0] == '\r' && data[1] == '\n')
return;
}

/* temporary remove a last new-line code */
if (data[size - 1] == '\n') {
data[size - 1] = '\0';
Expand Down

0 comments on commit ba6b3d7

Please sign in to comment.