Skip to content

Commit

Permalink
Fix webdav crash bug in digest auth handling (#16003)
Browse files Browse the repository at this point in the history
  • Loading branch information
warmenhoven authored Dec 12, 2023
1 parent 44132c4 commit dfda186
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions network/cloud_sync/webdav.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,18 @@ static bool webdav_create_digest_auth(char *digest)
else if (string_starts_with(ptr, "algorithm="))
{
ptr += STRLEN_CONST("algorithm=");
sz = strchr(ptr, ',') + 1 - ptr;
webdav_st->algo = malloc(sz);
strlcpy(webdav_st->algo, ptr, sz);
ptr += sz;
if (strchr(ptr, ','))
{
sz = strchr(ptr, ',') + 1 - ptr;
webdav_st->algo = malloc(sz);
strlcpy(webdav_st->algo, ptr, sz);
ptr += sz;
}
else
{
webdav_st->algo = strdup(ptr);
ptr += strlen(ptr);
}
}
else if (string_starts_with(ptr, "opaque=\""))
{
Expand Down

0 comments on commit dfda186

Please sign in to comment.