Ensure received message buffer is terminated

This commit is contained in:
Jeremy Lakeman 2011-05-26 14:25:59 +09:30
parent 9b3c4f13bb
commit f532b32efa

View File

@ -209,8 +209,12 @@ int processRequest(unsigned char *packet,int len,
char messageLen = packet[pofs];
pofs++;
strncpy(emitterPhoneNumber, (const char*)packet+pofs, emitterPhoneNumberLen);
emitterPhoneNumber[emitterPhoneNumberLen]=0;
pofs+=emitterPhoneNumberLen;
strncpy(message, (const char*)packet+pofs, messageLen);
message[messageLen]=0;
pofs+=messageLen;
// Check if I'm the recipient