afp_setacl() reads the client's ace_count without checking against
the message size:
uint32_t ace_count;
memcpy(&ace_count, ibuf, sizeof(uint32_t));
ace_count = htonl(ace_count);
ibuf += 8; /* skip ACL flags (see acls.h) */
ret = set_acl(vol,
s_path->u_name,
(bitmap & kFileSec_Inherit),
(darwin_ace_t *)ibuf,
ace_count);
set_acl() passes ibuf (as darwin_aces) and ace_count to
map_aces_darwin_to_posix(), which will run off the end of the message
buffer and perhaps crash if ace_count is too big:
for ( ; ace_count != 0; ace_count--, darwin_aces++) {
darwin_ace_flags = ntohl(darwin_aces->darwin_ace_flags);
Here's a backtrace from a core dump:
#0 0x0000000000253ccb in map_aces_darwin_to_posix
(darwin_aces=0x8423e9ff6, def_aclp=0x820273930, acc_aclp=0x820273928, ace_count=268391768, default_acl_flags=0x820273914) at acls.c:823
#1 0x0000000000251f90 in set_acl
(vol=0x839b3ee20, name=0x25dca0 <mtoupath[upath]> "1", inherit=16, daces=0x8422ea036, ace_count=268435456) at acls.c:1344
#2 0x0000000000251a7a in afp_setacl
(obj=0x2641a0 , ibuf=0x8422ea036 "", ibuflen=112, rbuf=0x8411736f0 "\001", rbuflen=0x8411836f0) at acls.c:1746
#3 0x0000000000219e27 in afp_over_dsi (obj=0x2641a0 ) at afp_dsi.c:627
#4 0x0000000000242dc0 in dsi_start
(obj=0x2641a0 , dsi=0x841173000, server_children=0x839b178c0)
at main.c:474
#5 0x00000000002423f6 in main (ac=2, av=0x820273c88) at main.c:417
afp_setacl() reads the client's ace_count without checking against
the message size:
set_acl() passes ibuf (as darwin_aces) and ace_count to
map_aces_darwin_to_posix(), which will run off the end of the message
buffer and perhaps crash if ace_count is too big:
Here's a backtrace from a core dump:
#0 0x0000000000253ccb in map_aces_darwin_to_posix
(darwin_aces=0x8423e9ff6, def_aclp=0x820273930, acc_aclp=0x820273928, ace_count=268391768, default_acl_flags=0x820273914) at acls.c:823
#1 0x0000000000251f90 in set_acl
(vol=0x839b3ee20, name=0x25dca0 <mtoupath[upath]> "1", inherit=16, daces=0x8422ea036, ace_count=268435456) at acls.c:1344
#2 0x0000000000251a7a in afp_setacl
(obj=0x2641a0 , ibuf=0x8422ea036 "", ibuflen=112, rbuf=0x8411736f0 "\001", rbuflen=0x8411836f0) at acls.c:1746
#3 0x0000000000219e27 in afp_over_dsi (obj=0x2641a0 ) at afp_dsi.c:627
#4 0x0000000000242dc0 in dsi_start
(obj=0x2641a0 , dsi=0x841173000, server_children=0x839b178c0)
at main.c:474
#5 0x00000000002423f6 in main (ac=2, av=0x820273c88) at main.c:417