Skip to content

Commit

Permalink
[BugFix] fix BE crash when http api request for pprof/cmdline (#51077)
Browse files Browse the repository at this point in the history
Why I'm doing:
BE crash when http api request for pprof/cmdline
curl -s --location-trusted -uroot:"" 'http://127.0.0.1:8040/pprof/cmdline'

What I'm doing:
max field width should be specified in fscanf() so that it does not overflow the buffer

curl -s --location-trusted -uroot:"" 'http://127.0.0.1:8040/pprof/cmdline'
/opensource/deploystarrocks/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678912345678901234567890123456789012345678901234567890123456/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678912345678901234567890123456789012345678901234567890123456/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678912345678901234567890123456789012345678901234567890123456/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567891234567890123456789012345678

Fixes #51076

Signed-off-by: Rohit Satardekar <[email protected]>
(cherry picked from commit 3543f1d)
  • Loading branch information
rohitrs1983 authored and mergify[bot] committed Sep 19, 2024
1 parent 8630140 commit 514491d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion be/src/http/action/pprof_actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void CmdlineAction::handle(HttpRequest* req) {
return;
}
char buf[1024];
if (fscanf(fp, "%s ", buf) != 1) {
if (fscanf(fp, "%1023s ", buf) != 1) {
strcpy(buf, "read cmdline failed");
}
fclose(fp);
Expand Down

0 comments on commit 514491d

Please sign in to comment.