Skip to content
Permalink
Browse files Browse the repository at this point in the history
parser BUGFIX long identityref default value buffer overflow
STRING_OVERFLOW (CWE-120)
  • Loading branch information
michalvasko committed Dec 4, 2019
1 parent f6d684a commit 6980afa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/parser.c
Expand Up @@ -1021,8 +1021,10 @@ make_canonical(struct ly_ctx *ctx, int type, const char **value, void *data1, vo
module_name = (const char *)data1;
/* identity must always have a prefix */
if (!strchr(*value, ':')) {
LY_CHECK_ERR_RETURN(strlen(module_name) + 1 + strlen(*value) > buf_len, LOGBUF(*value), -1);
sprintf(buf, "%s:%s", module_name, *value);
} else {
LY_CHECK_ERR_RETURN(strlen(*value) > buf_len, LOGBUF(*value), -1);
strcpy(buf, *value);
}
break;
Expand Down

0 comments on commit 6980afa

Please sign in to comment.