diff --git a/scapy/contrib/cdp.py b/scapy/contrib/cdp.py | |
index a1532b78..83963ff4 100644 | |
--- a/scapy/contrib/cdp.py | |
+++ b/scapy/contrib/cdp.py | |
@@ -392,7 +392,7 @@ class _CDPChecksum: | |
This padding is only used for checksum computation. The original | |
packet should not be altered.""" | |
if len(pkt) % 2: | |
- last_chr = orb(pkt[-1]) | |
+ last_chr = orb(pkt[len(pkt)-1:]) | |
if last_chr <= 0x80: | |
return pkt[:-1] + b'\x00' + chb(last_chr) | |
else: | |