diff options
| author | Aurélien Brooke <aurelien@bahiasoft.fr> | 2025-07-18 11:45:41 +0200 |
|---|---|---|
| committer | Aurélien Brooke <aurelien@bahiasoft.fr> | 2025-07-18 16:51:41 +0200 |
| commit | cc5965b266e0803c5bd138083ac620274a275710 (patch) | |
| tree | c4fc25f78e7e77266919e9c0554dd9b3c2328efc /src/tools/moc/preprocessor.cpp | |
| parent | f650ac0047d5ca2aff03a89e8759f9298ab6ce49 (diff) | |
moc: ensure printMsg() respects QByteArrayView boundaries
printMsg() receives a message as a QByteArrayView, which is not
guaranteed to be NUL-terminated. Using fprintf with %s could lead to
reading past the view's bounds.
This wasn't an issue previously, since all QByteArrayViews passed were
derived from QByteArrays or const char *, which are NUL-terminated by
design.
To future-proof the code, use %.*s with msg.size() to ensure only the
bytes inside bounds are printed.
Change-Id: I690e0dabdfc4ea9c23426ef98950845a35cd407a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/tools/moc/preprocessor.cpp')
0 files changed, 0 insertions, 0 deletions
