Skip to content

Commit

Permalink
s/apparmor: trim whitespace from permstable32_version before parsing
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Calder <[email protected]>
  • Loading branch information
olivercalder committed Sep 10, 2024
1 parent 094a2c7 commit 5e27752
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sandbox/apparmor/apparmor.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ func probeKernelFeaturesPermstable32Version() (int64, error) {
if err != nil {
return 0, err
}
return strconv.ParseInt(string(data), 0, 64)
return strconv.ParseInt(strings.TrimSpace(string(data)), 0, 64)
}

func probeParserFeatures() ([]string, error) {
Expand Down
4 changes: 2 additions & 2 deletions sandbox/apparmor/apparmor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,15 @@ func (s *apparmorSuite) TestProbeAppArmorKernelFeaturesPermstable32Version(c *C)
ver int64
}{
{
"0x000001",
"0x000001\n",
1,
},
{
"0x2",
2,
},
{
"0x0000000000000003",
"0x0000000000000003\n",
3,
},
{
Expand Down

0 comments on commit 5e27752

Please sign in to comment.