]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Get rid of an unneeded variable.
authorGuy Harris <[email protected]>
Tue, 29 Aug 2017 22:05:00 +0000 (15:05 -0700)
committerGuy Harris <[email protected]>
Tue, 29 Aug 2017 22:05:00 +0000 (15:05 -0700)
We don't want to try to suppress warnings about discarding the const
qualifier, as that's something we need to fix.  Adding the extra
variable doesn't suppress it on some platforms, so it's not useful
there, and if it does suppress it, we don't want that.

And we weren't doing it in the other case, anyway.

Comment in both cases with an XXX comment about the cast.

print-esp.c

index 433b2214c3ebd0ff76847c933f96fe488f99b850..38aa66632d76b2f789b449188655e90d76d15d96 100644 (file)
@@ -156,7 +156,7 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
 {
        struct sa_list *sa;
        const u_char *iv;
-       u_char *buf_mut, *output_buffer;
+       u_char *output_buffer;
        int len, block_size, output_buffer_size;
        EVP_CIPHER_CTX *ctx;
 
@@ -203,10 +203,11 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
        EVP_Cipher(ctx, output_buffer, buf, len);
        EVP_CIPHER_CTX_free(ctx);
 
-       buf_mut = (u_char*) buf;
-       /* Of course this is wrong, because buf is a const buffer, but changing this
-        * would require more complicated fix. */
-       memcpy(buf_mut, output_buffer, len);
+       /*
+        * XXX - of course this is wrong, because buf is a const buffer,
+        * but changing this would require a more complicated fix.
+        */
+       memcpy(buf, output_buffer, len);
        free(output_buffer);
 
        ndo->ndo_packetp = buf;
@@ -745,6 +746,11 @@ esp_print(netdissect_options *ndo,
                         * Also it should be of size that is multiple of cipher block size. */
                        EVP_Cipher(ctx, output_buffer, p + ivlen, len);
                        EVP_CIPHER_CTX_free(ctx);
+                       /*
+                        * XXX - of course this is wrong, because buf is a
+                        * const buffer, but changing this would require a
+                        * more complicated fix.
+                        */
                        memcpy(p + ivlen, output_buffer, len);
                        free(output_buffer);
                        advance = ivoff - (const u_char *)esp + ivlen;