mirror of
https://github.com/aphrody-labs/apk-tools.git
synced 2026-10-14 05:29:00 +00:00
libfetch: fix use-after-free in connection cache management
fixes #10734
This commit is contained in:
1 parent
4087ab92c4
commit
d430a98976
1 file changed
+3
-3
+3
-3
@@ -381,7 +381,7 @@ fetch_cache_get(const struct url *url, int af)
|
||||
void
|
||||
fetch_cache_put(conn_t *conn, int (*closecb)(conn_t *))
|
||||
{
|
||||
conn_t *iter, *last;
|
||||
conn_t *iter, *last, *next_cached;
|
||||
int global_count, host_count;
|
||||
|
||||
if (conn->cache_url == NULL || cache_global_limit == 0) {
|
||||
@@ -391,8 +391,8 @@ fetch_cache_put(conn_t *conn, int (*closecb)(conn_t *))
|
||||
|
||||
global_count = host_count = 0;
|
||||
last = NULL;
|
||||
for (iter = connection_cache; iter;
|
||||
last = iter, iter = iter->next_cached) {
|
||||
for (iter = connection_cache; iter; last = iter, iter = next_cached) {
|
||||
next_cached = iter->next_cached;
|
||||
++global_count;
|
||||
if (strcmp(conn->cache_url->host, iter->cache_url->host) == 0)
|
||||
++host_count;
|
||||
|
||||
Reference in new issue
Block a user