From 4cd6c21f1e114b2715179b9b0391b3daa8cd964e Mon Sep 17 00:00:00 2001 From: Russ Meyerriecks Date: Mon, 17 Mar 2014 21:38:28 +0000 Subject: [PATCH] callerid: Logic error in checksum processing Callerid checksum-ing was being handled incorrectly here. When the checksum is calculated to be 0x00, it will perform 0x100-0x00 which results in 0x100. This value will then fail the otherwise correct callerid message. This patch changes the logic to simply add the calculated checksum to the transmitted 2's compliment checksum. Review: https://reviewboard.asterisk.org/r/3356/ (closes issue ASTERISK-23488) ........ Merged revisions 410710 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 410717 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@410747 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/callerid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/callerid.c b/main/callerid.c index db5e795ff0..8d5289bb89 100644 --- a/main/callerid.c +++ b/main/callerid.c @@ -621,7 +621,7 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, stru } break; case 5: /* Check checksum */ - if (b != (256 - (cid->cksum & 0xff))) { + if ((b + cid->cksum) & 0xff)) { ast_log(LOG_NOTICE, "Caller*ID failed checksum\n"); /* Try again */ cid->sawflag = 0; -- 2.47.2