mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-03 06:47:04 -04:00
security: fix format string vulnerability in hook.h example code
Input Validation: Low The documentation example code in hook.h passed the msg parameter directly as the format string to printf() and fprintf(). If copied by developers, this pattern creates a format string vulnerability where specially crafted msg content with format specifiers (%x, %n, etc.) could read/write memory. Use "%s" as the format string and pass msg as a data argument instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7982f52830
commit
9a4e0e4c85
1 changed files with 2 additions and 2 deletions
|
|
@ -89,10 +89,10 @@ extern "C" {
|
||||||
* \code{.c}
|
* \code{.c}
|
||||||
*
|
*
|
||||||
* static void bar_stdout(struct foo *f, const char *msg) {
|
* static void bar_stdout(struct foo *f, const char *msg) {
|
||||||
* printf(msg);
|
* printf("%s", msg);
|
||||||
* }
|
* }
|
||||||
* static void bar_stderr(struct foo *f, const char *msg) {
|
* static void bar_stderr(struct foo *f, const char *msg) {
|
||||||
* fprintf(stderr, msg);
|
* fprintf(stderr, "%s", msg);
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* struct foo* get_foo_from_somewhere() {
|
* struct foo* get_foo_from_somewhere() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue