-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Labels
Stalearea: Base OSBase OS Library (lib/os)Base OS Library (lib/os)bugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug
Description
vsnprintfcb
will write to the given string buffer even if the pointer is NULL
:
Lines 105 to 109 in 3462a2a
if (ctx.dp < ctx.dpe) { | |
ctx.dp[0] = 0; | |
} else { | |
ctx.dp[-1] = 0; | |
} |
Apparently having str==NULL && size==0
is valid: https://stackoverflow.com/a/37173612
The code above obviously needs to be wrapped in an if
condition, but what about struct str_ctx
? Adding 0 to a NULL pointer is fine AFAIK, but cbvprintf
may do something naughty with that.
Metadata
Metadata
Assignees
Labels
Stalearea: Base OSBase OS Library (lib/os)Base OS Library (lib/os)bugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug