In function __apn_create_binary_message() called htonl() to convert the identifier so parse the error message must use ntohl() to convert it back.If not, when the identifier is non-zero and a invalid token error occured(it's very luck in apn_send(), the identifier initialized from zero and most of time no error ouccured or just one token), will get a unmatched identifier, and try to get the token by tokens[invalid_id].Unfortunately, out of bound of array.
In function __apn_create_binary_message() called htonl() to convert the identifier so parse the error message must use ntohl() to convert it back.If not, when the identifier is non-zero and a invalid token error occured(it's very luck in apn_send(), the identifier initialized from zero and most of time no error ouccured or just one token), will get a unmatched identifier, and try to get the token by tokens[invalid_id].Unfortunately, out of bound of array.