always validate path in setpro and mkdir - avoid uninitialized pointer access

This commit is contained in:
Radim Kolar 2014-09-09 09:03:40 +02:00
parent 626c1dac57
commit 3d14c83e56
2 changed files with 17 additions and 14 deletions

View File

@ -13,6 +13,9 @@ Version NEXT
correctly zero entire sockaddr_in structure during name resolving, correctly zero entire sockaddr_in structure during name resolving,
error found by clang. error found by clang.
allow docbook dsssl stylesheets to be specified at scons command line allow docbook dsssl stylesheets to be specified at scons command line
always validate path in SETPRO and MKDIR even if packet is resent and
no action will be taken. This is needed to avoid uninitialised
pointer access during reply. Found by Clang.
Version 2.8.1b26 - 1 Oct 2009 Version 2.8.1b26 - 1 Oct 2009
fver now reports if server can process extra data in input packets. fver now reports if server can process extra data in input packets.

View File

@ -728,8 +728,6 @@ static void server_process_packet (unsigned bytes, UBUF * ub, int old,
send_error(from, ub, "Server is running in read-only mode") ; send_error(from, ub, "Server is running in read-only mode") ;
return; return;
} }
if(!old)
{
pe = validate_path(s1,l1,&pp,&di,0); pe = validate_path(s1,l1,&pp,&di,0);
if(pe) if(pe)
{ {
@ -738,6 +736,8 @@ static void server_process_packet (unsigned bytes, UBUF * ub, int old,
send_error(from, ub, pe) ; send_error(from, ub, pe) ;
return; return;
} }
if(!old)
{
CHECK_ACCESS_RIGHTS(DIR_MKDIR,L_MAKEDIR); CHECK_ACCESS_RIGHTS(DIR_MKDIR,L_MAKEDIR);
pe=server_make_dir(&pp,inet_num,&di); pe=server_make_dir(&pp,inet_num,&di);
if(pe) if(pe)
@ -778,8 +778,6 @@ static void server_process_packet (unsigned bytes, UBUF * ub, int old,
send_error(from, ub, "Server is running in read-only mode") ; send_error(from, ub, "Server is running in read-only mode") ;
return; return;
} }
if(!old)
{
pe = validate_path(s1,l1,&pp,&di,1); pe = validate_path(s1,l1,&pp,&di,1);
if(pe) if(pe)
{ {
@ -788,6 +786,8 @@ static void server_process_packet (unsigned bytes, UBUF * ub, int old,
send_error(from, ub, pe) ; send_error(from, ub, pe) ;
return; return;
} }
if(!old)
{
CHECK_ACCESS_RIGHTS(DIR_OWNER,L_SETPRO); CHECK_ACCESS_RIGHTS(DIR_OWNER,L_SETPRO);
pe = server_set_pro(di,s2); pe = server_set_pro(di,s2);
if(pe) if(pe)