Skip to content

Commit

Permalink
fix(PeriphDrivers): Fix MXC_SYS_GetUSN Buffer Overflow (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Carter committed Jun 18, 2024
1 parent 1430a0c commit 74a552e
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
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

0 comments on commit 74a552e

Please sign in to comment.