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
@ -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,6 +437,7 @@ upap_rauthack(u, inp, id, len)
|
||||
return;
|
||||
}
|
||||
GETCHAR(msglen, inp);
|
||||
if (msglen > 0) {
|
||||
len -= sizeof (u_char);
|
||||
if (len < msglen) {
|
||||
UPAPDEBUG(("pap_rauthack: rcvd short packet."));
|
||||
@ -444,6 +445,7 @@ upap_rauthack(u, inp, id, len)
|
||||
}
|
||||
msg = (char *) inp;
|
||||
PRINTMSG(msg, msglen);
|
||||
}
|
||||
|
||||
u->us_clientstate = UPAPCS_OPEN;
|
||||
|
||||
@ -475,6 +477,7 @@ upap_rauthnak(u, inp, id, len)
|
||||
return;
|
||||
}
|
||||
GETCHAR(msglen, inp);
|
||||
if (msglen > 0) {
|
||||
len -= sizeof (u_char);
|
||||
if (len < msglen) {
|
||||
UPAPDEBUG(("pap_rauthnak: rcvd short packet."));
|
||||
@ -482,6 +485,7 @@ upap_rauthnak(u, inp, id, len)
|
||||
}
|
||||
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