main.conf: Fix parsing of uint32_t values
Luiz Augusto von Dentz
maintainerPATCH 1/1 main.conf: Fix parsing of uint32_t values
From: Luiz Augusto von Dentz <[email protected]>
Passing UINT32_MAX as int may overfollow causing errors such as:
bluetoothd[2688495]: src/main.c:parse_config_int() General.TemporaryTimeout = 60 is out of range (> -1)
--- src/main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
src/main.c +7 -5
@@ -440,9 +440,9 @@ static bool parse_config_string(GKeyFile *config, const char *group,static bool parse_config_int (GKeyFile *config,const char *group,const char *key,int *val, -int min,int max) +size_t min,size_t max) { -int tmp; +size_t tmp;char *str =NULL ;char *endptr =NULL ;
@@ -456,12 +456,14 @@ static bool parse_config_int(GKeyFile *config, const char *group, }if (tmp < min) { -warn ("%s.%s = %d is out of range (< %d)" , group, key, tmp, min); +warn ("%s.%s = %zu is out of range (< %zu)" , group, key, tmp, + min);return false; }if (tmp > max) { -warn ("%s.%s = %d is out of range (> %d)" , group, key, tmp, max); +warn ("%s.%s = %zu is out of range (> %zu)" , group, key, tmp, + max);return false; }
@@ -774,7 +776,7 @@ static bool parse_config_u32(GKeyFile *config, const char *group, {int tmp; -if (!parse_config_int (config, group, key, &tmp,0 ,UINT32_MAX )) +if (!parse_config_int (config, group, key, &tmp, min, max))return false;if (val)
Signature · 1 line
2.41.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=783189
---Test result---
Test Summary:
CheckPatch PASS 0.37 seconds GitLint PASS 0.23 seconds BuildEll PASS 30.30 seconds BluezMake PASS 990.49 seconds MakeCheck PASS 12.41 seconds MakeDistcheck PASS 166.24 seconds CheckValgrind PASS 267.46 seconds CheckSmatch PASS 374.40 seconds bluezmakeextell PASS 111.83 seconds IncrementalBuild PASS 871.01 seconds ScanBuild PASS 1167.57 seconds
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Mon, 11 Sep 2023 13:54:47 -0700 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
Passing
UINT32_MAXas int may overfollow causing errors such as:bluetoothd[2688495]: src/main.c:parse_config_int() General.TemporaryTimeout = 60 is out of range (> -1)
[...]
Here is the summary with links:
- [BlueZ] main.conf: Fix parsing of uint32_t values
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=53542db3d6c6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html