mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 18:45:40 +08:00
Memory safety issues on configuration reload
memcpy for potentially overlapped regions replaced with memmove
This commit is contained in:
parent
4ab2da228b
commit
6c187d167b
@ -313,7 +313,7 @@ int parsestr (unsigned char *str, unsigned char **argm, int nitems, unsigned cha
|
|||||||
len = 0;
|
len = 0;
|
||||||
if(argm[argc]!=(incbegin+1)) {
|
if(argm[argc]!=(incbegin+1)) {
|
||||||
len = (int)strlen((char *)argm[argc]);
|
len = (int)strlen((char *)argm[argc]);
|
||||||
memcpy(buf+*inbuf, argm[argc], len);
|
memmove(buf+*inbuf, argm[argc], len);
|
||||||
}
|
}
|
||||||
if((res = read(fd, buf+*inbuf+len, STRINGBUF-(1+len))) <= 0) {
|
if((res = read(fd, buf+*inbuf+len, STRINGBUF-(1+len))) <= 0) {
|
||||||
perror((char *)incbegin+1);
|
perror((char *)incbegin+1);
|
||||||
@ -1873,7 +1873,7 @@ int readconfig(FILE * fp){
|
|||||||
struct commands * cm;
|
struct commands * cm;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
if( !(buf = myalloc(bufsize)) || ! (argv = myalloc(NPARAMS * sizeof(unsigned char *) + 1)) ) {
|
if( !(buf = myalloc(bufsize)) || ! (argv = myalloc((NPARAMS + 1) * sizeof(unsigned char *))) ) {
|
||||||
fprintf(stderr, "No memory for configuration");
|
fprintf(stderr, "No memory for configuration");
|
||||||
return(10);
|
return(10);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user