errors detected by undefined behavior sanitizer

This commit is contained in:
francescomani
2023-05-29 08:49:52 +02:00
parent ef06b14501
commit 9d9e6bf17f
8 changed files with 31 additions and 41 deletions
+3 -3
View File
@@ -220,9 +220,9 @@ uint8_t pulls16(uint8_t **in, int16_t *out, uint8_t *end) {
uint8_t pull32(uint8_t **in, uint32_t *out, uint8_t *end) {
uint8_t *pIn = *in;
if((end - pIn) >=4 ) {
*out = (pIn[0] << 24) | (pIn[1] << 16) | (pIn[2] << 8) | pIn[3];
(*in)+=4;
if((end - pIn) >= 4) {
*out = ((uint32_t)pIn[0] << 24) | (pIn[1] << 16) | (pIn[2] << 8) | pIn[3];
(*in) += 4;
return 4;
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);