diff --git a/print-isoclns.c b/print-isoclns.c
index 5763705..4b81605 100644
--- a/print-isoclns.c
+++ b/print-isoclns.c
@@ -2741,9 +2741,15 @@ osi_print_cksum (const u_int8_t *pptr, u_int16_t checksum,
                     u_int checksum_offset, u_int length)
 {
         u_int16_t calculated_checksum;
-
-        /* do not attempt to verify the checksum if it is zero */
-        if (!checksum) {
+        /* do not attempt to verify the checksum if it is zero,
+         * if the total length is nonsense,
+         * if the offset is nonsense,
+         * or the base pointer is not sane
+         */
+        if (!checksum
+            || length > snaplen
+            || checksum_offset > snaplen
+            || checksum_offset > length) {
                 printf("(unverified)");
         } else {
                 calculated_checksum = create_osi_cksum(pptr, checksum_offset, length);
