adobkin / libcapn

A simple C Library for interact with the Apple Push Notification Service (APNs)
MIT License
100 stars 35 forks source link

forget the ntohl() in __apn_parse_apns_error() then got a unmatched identifier #12

Closed hex2tan closed 9 years ago

hex2tan commented 9 years ago

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.

adobkin commented 9 years ago

Merged, thnx!