Skip to content

Vlan_SetMacAddr forced type conversion out of bounds #24

@christine-pp

Description

@christine-pp

Problem/Opportunity

Vlan_SetMacAddr in valn_apis.c forced type conversion out of bounds when do Vlan_GetEthLinkMacOffset to forced int add to ULONG add tranversion.

Steps to reproduce

1 supposed the mac get in platform_hal_GetBaeMacAddress is "00:33:44:22:00:88"
2 number will be 3344220088
3 after do Vlan_GetEthLinkMacOffSet, the add is forced to transversion to ULONG type, supposed the add is 0
4 print the number value ,it will be 3300000000, because four bytes of number were overwritten by the forced type conversion of add.

Expected Behavior

1 supposed the mac get in platform_hal_GetBaeMacAddress is "00:33:44:22:00:88"
2 number will be 3344220088
3 after do Vlan_GetEthLinkMacOffSet
4 print the number value ,it should still be 3344220088

Actual Behavior

1 supposed the mac get in platform_hal_GetBaeMacAddress is "00:33:44:22:00:88"
2 number will be 3344220088
3 after do Vlan_GetEthLinkMacOffSet, the add is forced to transversion to ULONG type, supposed the add is 0
4 print the number value ,it will be 3300000000, because four bytes of number were overwritten by the forced type conversion of add.

Notes (Optional)

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions