F
Fernando Barsoba
Hi all,
I'm trying to reassign the address of a pointer inside a function and
return it once the function has done its things... However, the address
returned is not the address I wanted to return.. let me explain it
better with the actual example:
caller function:
Memory address for AH here is 0x610fd552
callee function:
Memory address after assignment is 0x22ec30
The memory address returned is supposedly 0x22ec30, but when going back
to the caller function, the memory address is 0x610fd552.
Clearly, I'm doing something wrong conceptually.. any idea on how to
solve this?
Thanks,
FBM
I'm trying to reassign the address of a pointer inside a function and
return it once the function has done its things... However, the address
returned is not the address I wanted to return.. let me explain it
better with the actual example:
caller function:
struct authenHeader * AH;
setAuhenticationH(authenHeader, sizeof(authenHeader), AH);
Memory address for AH here is 0x610fd552
callee function:
struct authenHeader * setAuhenticationH(uint8_t *autH, unsigned short length, struct authenHeader *AH) {
int authenHeader_size;
authenHeader_size = sizeof(struct authenHeader);
bzero(autH, authenHeader_size);
AH = (struct authenHeader *)autH;
Memory address after assignment is 0x22ec30
AH->nexth = 4;
AH->payloadlen = 4; /* for tests, standard case: 3 32-bit word fixed portion + 96-bit authentication
value. In 32-bit words, 3+3-2 = 4 */
AH->resvd = 0;
AH->spi = 0;
AH->seqnum = 0x00;
return AH;
}
The memory address returned is supposedly 0x22ec30, but when going back
to the caller function, the memory address is 0x610fd552.
Clearly, I'm doing something wrong conceptually.. any idea on how to
solve this?
Thanks,
FBM