if (t->opt == TCP_CONGESTION) {
                char old_cc[16], tmp_cc[16];
                const char *new_cc;
+               int new_cc_len;
 
                if (bpf_getsockopt(ctx, IPPROTO_TCP, TCP_CONGESTION, old_cc, sizeof(old_cc)))
                        return 1;
-               if (!bpf_strncmp(old_cc, sizeof(old_cc), cubic_cc))
+               if (!bpf_strncmp(old_cc, sizeof(old_cc), cubic_cc)) {
                        new_cc = reno_cc;
-               else
+                       new_cc_len = sizeof(reno_cc);
+               } else {
                        new_cc = cubic_cc;
+                       new_cc_len = sizeof(cubic_cc);
+               }
                if (bpf_setsockopt(ctx, IPPROTO_TCP, TCP_CONGESTION, (void *)new_cc,
-                                  sizeof(new_cc)))
+                                  new_cc_len))
                        return 1;
                if (bpf_getsockopt(ctx, IPPROTO_TCP, TCP_CONGESTION, tmp_cc, sizeof(tmp_cc)))
                        return 1;