Skip to content

Fix buffer size calculation and bounds checks in ppdEmitString - #92

Open
RanjanKumar-rj wants to merge 1 commit into
OpenPrinting:masterfrom
RanjanKumar-rj:fix-ppd-emit-bounds
Open

RanjanKumar-rj wants to merge 1 commit into
OpenPrinting:masterfrom
RanjanKumar-rj:fix-ppd-emit-bounds

Conversation

@RanjanKumar-rj

Copy link
Copy Markdown

Update the Pass-1 buffer size estimation in ppdEmitString() to account for the maximum formatted length of floating-point custom parameters emitted by _ppdStrFormatd() ("%.12f").

Additionally, replace the unbounded memcpy() of option code strings in Pass-2 with strlcpy() and guard trailing newline writes against buffer end bounds so bufptr cannot advance past bufend.

Closes #84

Update the Pass-1 buffer size estimation in ppdEmitString() to account
for the maximum formatted length of floating-point custom parameters
emitted by _ppdStrFormatd() ("%.12f").

Additionally, replace the unbounded memcpy() of option code strings in
Pass-2 with strlcpy() and guard trailing newline writes against buffer
end bounds so bufptr cannot advance past bufend.

Signed-off-by: Ranjan Kumar <kumarranja@chromium.org>
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

Successfully merging this pull request may close these issues.

libppd: Custom real parameters overflow ppdEmitString

1 participant