Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HdlcEncoder::decode lack of validation #5

Open
lucasduffey opened this issue Jan 3, 2020 · 0 comments
Open

HdlcEncoder::decode lack of validation #5

lucasduffey opened this issue Jan 3, 2020 · 0 comments

Comments

@lucasduffey
Copy link

lucasduffey commented Jan 3, 2020

https://github.com/openpst/libopenpst/blob/master/src/qualcomm/hdlc_encoder.cpp#L93

// off-by-one OOB read if i == length of data
buffer[osize++] = data[i + 1] ^ HDLC_ESC_MASK;

https://github.com/openpst/libopenpst/blob/master/src/qualcomm/hdlc_encoder.cpp#L102

// int underflow if sizeof(crc) > osize
uint16_t crc = crc16(reinterpret_cast<const char*>(buffer), osize - sizeof(crc));

https://github.com/openpst/libopenpst/blob/master/src/qualcomm/hdlc_encoder.cpp#L103

// OOB read if buffer length < 2
uint16_t chk = *((uint16_t*)&buffer[osize - 2]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant