system: fastboot: bound filedump path parsing#3608
Open
Old-Ding wants to merge 1 commit into
Open
Conversation
Parse the filedump path token separately before copying it into the fixed PATH_MAX buffer. This avoids overflowing the upload path when a host sends an overlong fastboot oem filedump argument while preserving the existing offset and size parsing behavior. Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
| return; | ||
| } | ||
|
|
||
| ret = sscanf(arg, "%s %" PRIdOFF " %zu", ctx->upload_param.u.file.path, |
Contributor
There was a problem hiding this comment.
what's problem call sscanf
Contributor
There was a problem hiding this comment.
target buffer overflow evasion?
cederom
reviewed
Jul 6, 2026
| ret = sscanf(params, "%" PRIdOFF " %zu", | ||
| &ctx->upload_param.u.file.offset, &ctx->upload_param.size); | ||
| if (ret != 1 && ret != 3) | ||
| if (ret != EOF && ret != 0 && ret != 2) |
Contributor
There was a problem hiding this comment.
if ( ret==EOF || ret==0 || ret!=2 ) ?
Failed covnersion when EOF is returned, or zero elements assigned, or not two elements assigned? :-P
cederom
reviewed
Jul 6, 2026
| return; | ||
| } | ||
| else if (ret == 1) | ||
| else if (ret != 2) |
Contributor
There was a problem hiding this comment.
This should go up in a separate check after file path is parsed? :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing