libauth: add sanity check for auth_proxy write size
This commit is contained in:
parent
eee51d7720
commit
b5aab82488
1 changed files with 3 additions and 2 deletions
|
@ -157,9 +157,10 @@ fauth_proxy(int fd, AuthRpc *rpc, AuthGetkey *getkey, char *params)
|
||||||
n = 0;
|
n = 0;
|
||||||
memset(buf, 0, AuthRpcMax);
|
memset(buf, 0, AuthRpcMax);
|
||||||
while((ret = dorpc(rpc, "write", buf, n, getkey)) == ARtoosmall){
|
while((ret = dorpc(rpc, "write", buf, n, getkey)) == ARtoosmall){
|
||||||
if(atoi(rpc->arg) > AuthRpcMax)
|
m = atoi(rpc->arg);
|
||||||
|
if(m <= n || m > AuthRpcMax)
|
||||||
break;
|
break;
|
||||||
m = read(fd, buf + n, atoi(rpc->arg) - n);
|
m = read(fd, buf + n, m - n);
|
||||||
if(m <= 0){
|
if(m <= 0){
|
||||||
if(m == 0)
|
if(m == 0)
|
||||||
werrstr("auth_proxy short read: %s",
|
werrstr("auth_proxy short read: %s",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue