diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-28 21:16:14 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-28 21:16:14 +0100 |
| commit | 0d51f4ce3826f78d23bfa48b2ac447f1fd91a0af (patch) | |
| tree | add4d99abf1d194e2ded94b70cbc062aee58e96c /src/ot_http.c | |
| parent | 70485a0ecf6b1ae9520deb4af0490fdb48643836 (diff) | |
When sorting/unique-ing client provided info_hashes, the memcpy's src and dest might be identical, so use memmove
Diffstat (limited to 'src/ot_http.c')
| -rw-r--r-- | src/ot_http.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ot_http.c b/src/ot_http.c index 406fec3..4bd5431 100644 --- a/src/ot_http.c +++ b/src/ot_http.c | |||
| @@ -536,7 +536,7 @@ static ssize_t http_handle_scrape(const int64_t sock, struct ot_workstruct *ws, | |||
| 536 | qsort(multiscrape_buf, numwant, sizeof(ot_hash), compare_hash); | 536 | qsort(multiscrape_buf, numwant, sizeof(ot_hash), compare_hash); |
| 537 | for (i = unique = 1; i < numwant; ++i) | 537 | for (i = unique = 1; i < numwant; ++i) |
| 538 | if (memcmp(multiscrape_buf[i], multiscrape_buf[unique - 1], sizeof(ot_hash))) | 538 | if (memcmp(multiscrape_buf[i], multiscrape_buf[unique - 1], sizeof(ot_hash))) |
| 539 | memcpy(multiscrape_buf[unique++], multiscrape_buf[i], sizeof(ot_hash)); | 539 | memmove(multiscrape_buf[unique++], multiscrape_buf[i], sizeof(ot_hash)); |
| 540 | numwant = unique; | 540 | numwant = unique; |
| 541 | 541 | ||
| 542 | /* Enough for http header + whole scrape string */ | 542 | /* Enough for http header + whole scrape string */ |
