mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 18:45:40 +08:00
Fix acl copy / auth copy out-of-memory error
This commit is contained in:
parent
c1c5875356
commit
dbbbe59ef2
@ -1038,11 +1038,13 @@ static void * itcopy (void * from, size_t size){
|
|||||||
struct auth * copyauth (struct auth * authfuncs){
|
struct auth * copyauth (struct auth * authfuncs){
|
||||||
struct auth * newauth = NULL;
|
struct auth * newauth = NULL;
|
||||||
|
|
||||||
newauth = authfuncs = itcopy(authfuncs, sizeof(struct auth));
|
newauth = itcopy(authfuncs, sizeof(struct auth));
|
||||||
for( ; authfuncs->next; authfuncs = authfuncs->next){
|
for( authfuncs=newauth; authfuncs; authfuncs = authfuncs->next){
|
||||||
|
if(authfuncs->next){
|
||||||
authfuncs->next = itcopy(authfuncs->next, sizeof(struct auth));
|
authfuncs->next = itcopy(authfuncs->next, sizeof(struct auth));
|
||||||
if(!authfuncs->next)break;
|
if(!authfuncs->next)break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(authfuncs){
|
if(authfuncs){
|
||||||
freeauth(newauth);
|
freeauth(newauth);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1059,8 +1061,8 @@ struct ace * copyacl (struct ace *ac){
|
|||||||
struct period *pel;
|
struct period *pel;
|
||||||
struct hostname *hst;
|
struct hostname *hst;
|
||||||
|
|
||||||
ret = ac = itcopy(ac, sizeof(struct ace));
|
ret = itcopy(ac, sizeof(struct ace));
|
||||||
for( ; ac->next; ac = ac->next){
|
for( ac = ret; ac; ac = ac->next){
|
||||||
if(ac->src){
|
if(ac->src){
|
||||||
ac->src = itcopy(ac->src, sizeof(struct iplist));
|
ac->src = itcopy(ac->src, sizeof(struct iplist));
|
||||||
if(!ac->src) goto ERRORSRC;
|
if(!ac->src) goto ERRORSRC;
|
||||||
@ -1162,6 +1164,10 @@ struct ace * copyacl (struct ace *ac){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(ac->next){
|
||||||
|
ac->next = itcopy(ac->next, sizeof(struct ace));
|
||||||
|
if(!ac->next) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!ac) return ret;
|
if(!ac) return ret;
|
||||||
ERRORSRC:
|
ERRORSRC:
|
||||||
|
Loading…
Reference in New Issue
Block a user