From c4d19650d5455a7f6e7c12d5b88d87b784124644 Mon Sep 17 00:00:00 2001 From: Moshe Kaplan Date: Mon, 7 Dec 2020 17:00:19 -0500 Subject: wiretap/erf: Use memmove instead of memcpy It's possible for memcpy's source and destination to be the same address, and so therefore 'overlap'. Use memmove instead, which is safe for overlapping regions. This fixes Coverity 1450802. --- wiretap/erf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wiretap/erf.c') diff --git a/wiretap/erf.c b/wiretap/erf.c index 7633d1e470..ffa4b9f198 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -1967,7 +1967,7 @@ static gboolean erf_dump( /* XXX: What about ERF-in-pcapng with existing comment (that wasn't * modified)? */ if(rec->has_comment_changed) { - memcpy(&other_phdr, pseudo_header, sizeof(union wtap_pseudo_header)); + memmove(&other_phdr, pseudo_header, sizeof(union wtap_pseudo_header)); if(!erf_write_anchor_meta_update_phdr(wdh, dump_priv, rec, &other_phdr, err)) return FALSE; pseudo_header = &other_phdr; } -- cgit v1.2.3