Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Fix off by ones when parsing XML comments #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

disconnect3d
Copy link

@disconnect3d disconnect3d commented May 1, 2020

This commit fixes off by ones when parsing XML comments.

The strncmp calls before this commit: strncmp(cursor, "<!--", 3) would also incorrectly match shorter strings such as "<!-". Depending on the use-cases this might or might not be vulnerabilities.

This could be a security bug/risk for the
callers of this library, e.g. if two different XML parsing libraries
would be used, e.g., for validating and then executing some policies. I would
even say this could cause bugs similar to
https://twitter.com/s1guza/status/1255641164885131268 to happen.

This issue was first reported to Google on Apr 13, 2020 via
https://www.google.com/appserve/security-bugs/ but I was replied with
"We think the issue might not be severe enough for us to track it as a
security bug", so I am sending a fix here.

This commit fixes off by ones when parsing XML comments.

The `strncmp` calls before this commit: strncmp(cursor, "<!--", 3) would also incorrectly match shorter strings such as "<!-". Depending on the use-cases this might or might not be vulnerabilities.

Depending on the use, this issue could be a security bug/risk for the
callers of this library, e.g. if two different XML parsing libraries
would be used for e.g. validating and then executing some rules. I would
even say this could cause bugs similar to
https://twitter.com/s1guza/status/1255641164885131268 to happen.

This issue was first reported to Google via
https://www.google.com/appserve/security-bugs/ but I was replied with
"We think the issue might not be severe enough for us to track it as a
security bug", so I am sending a fix here.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant