Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PeriphDrivers): Fix MXC_SYS_GetUSN Buffer Overflow #1016

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_ai85.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
uint32_t _usn_32[MXC_SYS_USN_CHECKSUM_LEN / 4];
// ^ Declare as uint32_t to preserve mem alignment
uint8_t *_usn_8 = (uint8_t *)_usn_32;
memset(_usn_8, 0, MXC_SYS_USN_CHECKSUM_LEN);
memset(_usn_8, 0, MXC_SYS_USN_LEN);

_usn_8[0] = (infoblock[0] & 0x007F8000) >> 15;
_usn_8[1] = (infoblock[0] & 0x7F800000) >> 23;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_ai87.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
uint32_t _usn_32[MXC_SYS_USN_CHECKSUM_LEN / 4];
// ^ Declare as uint32_t to preserve mem alignment
uint8_t *_usn_8 = (uint8_t *)_usn_32;
memset(_usn_8, 0, MXC_SYS_USN_CHECKSUM_LEN);
memset(_usn_8, 0, MXC_SYS_USN_LEN);

_usn_8[0] = (infoblock[0] & 0x007F8000) >> 15;
_usn_8[1] = (infoblock[0] & 0x7F800000) >> 23;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me12.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
/* Read the USN from the info block */
MXC_FLC_UnlockInfoBlock(MXC_INFO0_MEM_BASE);

memset(usn, 0, MXC_SYS_USN_CHECKSUM_LEN);
memset(usn, 0, MXC_SYS_USN_LEN);

usn[0] = (infoblock[0] & 0x007F8000) >> 15;
usn[1] = (infoblock[0] & 0x7F800000) >> 23;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me14.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
/* Read the USN from the info block */
MXC_FLC_UnlockInfoBlock(MXC_INFO0_MEM_BASE);

memset(usn, 0, MXC_SYS_USN_CHECKSUM_LEN);
memset(usn, 0, MXC_SYS_USN_LEN);

usn[0] = (infoblock[0] & 0x007F8000) >> 15;
usn[1] = (infoblock[0] & 0x7F800000) >> 23;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me15.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
/* Read the USN from the info block */
MXC_FLC_UnlockInfoBlock(MXC_INFO0_MEM_BASE);

memset(usn, 0, MXC_SYS_USN_CHECKSUM_LEN);
memset(usn, 0, MXC_SYS_USN_LEN);

usn[0] = (infoblock[0] & 0x007F8000) >> 15;
usn[1] = (infoblock[0] & 0x7F800000) >> 23;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me16.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
/* Read the USN from the info block */
MXC_FLC_UnlockInfoBlock(MXC_INFO0_MEM_BASE);

memset(usn, 0, MXC_SYS_USN_CHECKSUM_LEN);
memset(usn, 0, MXC_SYS_USN_LEN);

usn[0] = (infoblock[0] & 0x007F8000) >> 15;
usn[1] = (infoblock[0] & 0x7F800000) >> 23;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me17.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
/* Read the USN from the info block */
MXC_FLC_UnlockInfoBlock(MXC_INFO0_MEM_BASE);

memset(usn, 0, MXC_SYS_USN_CHECKSUM_LEN);
memset(usn, 0, MXC_SYS_USN_LEN);

usn[0] = (infoblock[0] & 0x007F8000) >> 15;
usn[1] = (infoblock[0] & 0x7F800000) >> 23;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me18.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
/* Read the USN from the info block */
MXC_FLC_UnlockInfoBlock(MXC_INFO0_MEM_BASE);

memset(usn, 0, MXC_SYS_USN_CHECKSUM_LEN);
memset(usn, 0, MXC_SYS_USN_LEN);

usn[0] = (infoblock[0] & 0x007F8000) >> 15;
usn[1] = (infoblock[0] & 0x7F800000) >> 23;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me21.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
/* Read the USN from the info block */
MXC_FLC_UnlockInfoBlock(MXC_INFO0_MEM_BASE);

memset(usn, 0, MXC_SYS_USN_CHECKSUM_LEN);
memset(usn, 0, MXC_SYS_USN_LEN);

usn[0] = (infoblock[0] & 0x007F8000) >> 15;
usn[1] = (infoblock[0] & 0x7F800000) >> 23;
Expand Down
Loading