Skip to contentSkip to conversation

fix bad memcpy length

PATCH In review Bruce Rogers 2 participants 2 messages Oct 23, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix bad memcpy length

qemu/trunk/hw/bt-sdp.c +1 -1
@@ -254,7 +254,7 @@
     /* Perform the search */
     if (len < 7)
         return -SDP_INVALID_SYNTAX;
-    memcpy(&handle, req, 6);
+    memcpy(&handle, req, 4);
     req += 4;
     len -= 4;
 
Signed-off-by <[email protected]>
#1 lore raw

qemu/trunk/hw/bt-sdp.c line 257

Quoted 8 lines · Bruce Rogers
qemu/trunk/hw/bt-sdp.c +1 -1
@@ -254,7 +254,7 @@
     /* Perform the search */
     if (len < 7)
         return -SDP_INVALID_SYNTAX;
-    memcpy(&handle, req, 6);
+    memcpy(&handle, req, 4);

Changing one magic number to another doesn't make much sense. Why not this instead:

    memcpy(&handle, req, sizeof (handle));

Erik

Signature · 4 lines
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"life is too long to know C++ well" -- Erik Naggum