mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Correct buffer overflow in the handling of LCP options in ppp(4)
Security: FreeBSD-SA-06:18.ppp
This commit is contained in:
parent
c198287ff3
commit
6aa3bc96a6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=161556
@ -2363,7 +2363,8 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
|
||||
|
||||
/* pass 1: check for things that need to be rejected */
|
||||
p = (void*) (h+1);
|
||||
for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) {
|
||||
for (rlen=0; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len-=p[1], p+=p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s ", sppp_lcp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -2442,7 +2443,8 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
|
||||
|
||||
p = (void*) (h+1);
|
||||
len = origlen;
|
||||
for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) {
|
||||
for (rlen=0; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len-=p[1], p+=p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s ", sppp_lcp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -2584,7 +2586,8 @@ sppp_lcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len)
|
||||
SPP_ARGS(ifp));
|
||||
|
||||
p = (void*) (h+1);
|
||||
for (; len > 1 && p[1]; len -= p[1], p += p[1]) {
|
||||
for (; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len -= p[1], p += p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s ", sppp_lcp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -2648,7 +2651,8 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
|
||||
SPP_ARGS(ifp));
|
||||
|
||||
p = (void*) (h+1);
|
||||
for (; len > 1 && p[1]; len -= p[1], p += p[1]) {
|
||||
for (; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len -= p[1], p += p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s ", sppp_lcp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -3039,7 +3043,8 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
|
||||
log(LOG_DEBUG, SPP_FMT "ipcp parse opts: ",
|
||||
SPP_ARGS(ifp));
|
||||
p = (void*) (h+1);
|
||||
for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) {
|
||||
for (rlen=0; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len-=p[1], p+=p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s ", sppp_ipcp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -3108,7 +3113,8 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
|
||||
SPP_ARGS(ifp));
|
||||
p = (void*) (h+1);
|
||||
len = origlen;
|
||||
for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) {
|
||||
for (rlen=0; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len-=p[1], p+=p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s ", sppp_ipcp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -3239,7 +3245,8 @@ sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len)
|
||||
SPP_ARGS(ifp));
|
||||
|
||||
p = (void*) (h+1);
|
||||
for (; len > 1 && p[1]; len -= p[1], p += p[1]) {
|
||||
for (; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len -= p[1], p += p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s ", sppp_ipcp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -3285,7 +3292,8 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
|
||||
SPP_ARGS(ifp));
|
||||
|
||||
p = (void*) (h+1);
|
||||
for (; len > 1 && p[1]; len -= p[1], p += p[1]) {
|
||||
for (; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len -= p[1], p += p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s ", sppp_ipcp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -3511,7 +3519,8 @@ sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len)
|
||||
SPP_ARGS(ifp));
|
||||
p = (void*) (h+1);
|
||||
ifidcount = 0;
|
||||
for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) {
|
||||
for (rlen=0; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len-=p[1], p+=p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s", sppp_ipv6cp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -3561,7 +3570,8 @@ sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len)
|
||||
p = (void*) (h+1);
|
||||
len = origlen;
|
||||
type = CONF_ACK;
|
||||
for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) {
|
||||
for (rlen=0; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len-=p[1], p+=p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s", sppp_ipv6cp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -3660,7 +3670,8 @@ sppp_ipv6cp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len)
|
||||
SPP_ARGS(ifp));
|
||||
|
||||
p = (void*) (h+1);
|
||||
for (; len > 1 && p[1]; len -= p[1], p += p[1]) {
|
||||
for (; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len -= p[1], p += p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s", sppp_ipv6cp_opt_name(*p));
|
||||
switch (*p) {
|
||||
@ -3706,7 +3717,8 @@ sppp_ipv6cp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
|
||||
SPP_ARGS(ifp));
|
||||
|
||||
p = (void*) (h+1);
|
||||
for (; len > 1 && p[1]; len -= p[1], p += p[1]) {
|
||||
for (; len >= 2 && p[1] >= 2 && len >= p[1];
|
||||
len -= p[1], p += p[1]) {
|
||||
if (debug)
|
||||
log(-1, " %s", sppp_ipv6cp_opt_name(*p));
|
||||
switch (*p) {
|
||||
|
Loading…
Reference in New Issue
Block a user