mirror of
https://github.com/paulusmack/ppp.git
synced 2024-11-27 21:43:44 +08:00
don't print null received message, %.0[svq] prints nothing
This commit is contained in:
parent
bb92478eb0
commit
1924cd0951
30
pppd/upap.c
30
pppd/upap.c
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: upap.c,v 1.16 1999/04/28 02:45:44 paulus Exp $";
|
||||
static char rcsid[] = "$Id: upap.c,v 1.17 1999/06/24 00:17:48 paulus Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -437,13 +437,15 @@ upap_rauthack(u, inp, id, len)
|
||||
return;
|
||||
}
|
||||
GETCHAR(msglen, inp);
|
||||
len -= sizeof (u_char);
|
||||
if (len < msglen) {
|
||||
UPAPDEBUG(("pap_rauthack: rcvd short packet."));
|
||||
return;
|
||||
if (msglen > 0) {
|
||||
len -= sizeof (u_char);
|
||||
if (len < msglen) {
|
||||
UPAPDEBUG(("pap_rauthack: rcvd short packet."));
|
||||
return;
|
||||
}
|
||||
msg = (char *) inp;
|
||||
PRINTMSG(msg, msglen);
|
||||
}
|
||||
msg = (char *) inp;
|
||||
PRINTMSG(msg, msglen);
|
||||
|
||||
u->us_clientstate = UPAPCS_OPEN;
|
||||
|
||||
@ -475,13 +477,15 @@ upap_rauthnak(u, inp, id, len)
|
||||
return;
|
||||
}
|
||||
GETCHAR(msglen, inp);
|
||||
len -= sizeof (u_char);
|
||||
if (len < msglen) {
|
||||
UPAPDEBUG(("pap_rauthnak: rcvd short packet."));
|
||||
return;
|
||||
if (msglen > 0) {
|
||||
len -= sizeof (u_char);
|
||||
if (len < msglen) {
|
||||
UPAPDEBUG(("pap_rauthnak: rcvd short packet."));
|
||||
return;
|
||||
}
|
||||
msg = (char *) inp;
|
||||
PRINTMSG(msg, msglen);
|
||||
}
|
||||
msg = (char *) inp;
|
||||
PRINTMSG(msg, msglen);
|
||||
|
||||
u->us_clientstate = UPAPCS_BADAUTH;
|
||||
|
||||
|
12
pppd/utils.c
12
pppd/utils.c
@ -17,7 +17,7 @@
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: utils.c,v 1.5 1999/06/01 01:43:34 paulus Exp $";
|
||||
static char rcsid[] = "$Id: utils.c,v 1.6 1999/06/24 00:17:48 paulus Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -171,7 +171,8 @@ vslprintf(buf, buflen, fmt, args)
|
||||
if (*fmt == 0)
|
||||
break;
|
||||
c = *++fmt;
|
||||
width = prec = 0;
|
||||
width = 0;
|
||||
prec = -1;
|
||||
fillch = ' ';
|
||||
if (c == '0') {
|
||||
fillch = '0';
|
||||
@ -192,6 +193,7 @@ vslprintf(buf, buflen, fmt, args)
|
||||
prec = va_arg(args, int);
|
||||
c = *++fmt;
|
||||
} else {
|
||||
prec = 0;
|
||||
while (isdigit(c)) {
|
||||
prec = prec * 10 + c - '0';
|
||||
c = *++fmt;
|
||||
@ -265,11 +267,11 @@ vslprintf(buf, buflen, fmt, args)
|
||||
case 'q': /* quoted string */
|
||||
quoted = c == 'q';
|
||||
p = va_arg(args, unsigned char *);
|
||||
if (fillch == '0' && prec > 0) {
|
||||
if (fillch == '0' && prec >= 0) {
|
||||
n = prec;
|
||||
} else {
|
||||
n = strlen((char *)p);
|
||||
if (prec > 0 && prec < n)
|
||||
if (prec >= 0 && n > prec)
|
||||
n = prec;
|
||||
}
|
||||
while (n > 0 && buflen > 0) {
|
||||
@ -354,7 +356,7 @@ vslprintf(buf, buflen, fmt, args)
|
||||
len = num + sizeof(num) - 1 - str;
|
||||
} else {
|
||||
len = strlen(str);
|
||||
if (prec > 0 && len > prec)
|
||||
if (prec >= 0 && len > prec)
|
||||
len = prec;
|
||||
}
|
||||
if (width > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user