Skip to content

Commit

Permalink
presence_xml: prevent buffer overrun
Browse files Browse the repository at this point in the history
Fixes Coverity CID 40787 and 40833
  • Loading branch information
razvancrainea committed Oct 24, 2016
1 parent b0602d3 commit 4c42280
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions modules/presence_xml/xcap_auth.c
Expand Up @@ -477,7 +477,7 @@ static inline int get_resource_list(str *username, str *domain, str *filename, s
path.s = path_buf;
path.len = 0;
if (selector->s) {
while (checked < selector->len && path.len <= MAX_PATH_LEN)
while (checked < selector->len && path.len + 7 + 1/* \0 */ <= MAX_PATH_LEN)
{
if (selector->s[checked] == '/')
{
Expand Down Expand Up @@ -553,12 +553,8 @@ static inline int get_resource_list(str *username, str *domain, str *filename, s
return 0;

error:
if (doc != NULL)
{
if (doc->s != NULL)
pkg_free(doc->s);
pkg_free(doc);
}
pkg_free(doc->s);
pkg_free(doc);
if (etag != NULL)
{
if (etag->s != NULL)
Expand Down

0 comments on commit 4c42280

Please sign in to comment.