Browse Source

Fix sizeof() types for p_local_char

Rob Hoelz <rob@hoelz.ro> wrote:
"A fairly recent commit (c4af430) increased the size of local_char in
 add_dialplan, but the corresponding call to memcpy was not updated"

I fixed the two relevant calls to memcpy.

Fixes: #47
Reported-by: Rob Hoelz <rob@hoelz.ro>
Richard Laager 8 years ago
parent
commit
356bb9d9e0
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/docsis.c

+ 2 - 2
src/docsis.c

@@ -210,7 +210,7 @@ add_dialplan (unsigned char *tlvbuf, unsigned int tlvbuflen) {
   tlvbuflen += 1;
   local_char = 0x16 + fileSize;
   if (local_char < 0x80) {
-    memcpy(tlvbuf + tlvbuflen, p_local_char, sizeof(char));
+    memcpy(tlvbuf + tlvbuflen, p_local_char, sizeof(p_local_char));
     tlvbuflen += sizeof(char);
   } else {
     memcpy(tlvbuf + tlvbuflen, "\x82", 1);
@@ -236,7 +236,7 @@ add_dialplan (unsigned char *tlvbuf, unsigned int tlvbuflen) {
     tlvbuflen += sizeof(local_v_len);
   } else {
     local_char = (unsigned short) fileSize;
-    memcpy(tlvbuf + tlvbuflen, p_local_char, sizeof(char));
+    memcpy(tlvbuf + tlvbuflen, p_local_char, sizeof(p_local_char));
     tlvbuflen += sizeof(char);
   }