[client,common] fix possible NULL dereference

This commit is contained in:
akallabeth 2024-09-14 20:34:59 +02:00
parent 2bcf2c50eb
commit 3460f64f57
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
1 changed files with 4 additions and 3 deletions

View File

@ -434,15 +434,16 @@ static size_t print_description(const char* text, size_t start_offset, size_t cu
char* str = _strdup(text);
char* cur = str;
do
{
while (cur != NULL)
cur = print_token(cur, start_offset, &current, limit, " ", "\r\n");
} while (cur != NULL);
free(str);
const int rc = printf("\n");
if (rc >= 0)
{
WINPR_ASSERT(SIZE_MAX - rc >= current);
current += (size_t)rc;
}
return current;
}