]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Widen types in ipcp_reqci
authorPaul Mackerras <paulus@ozlabs.org>
Tue, 20 Aug 2024 08:21:47 +0000 (18:21 +1000)
committerPaul Mackerras <paulus@ozlabs.org>
Tue, 20 Aug 2024 08:21:47 +0000 (18:21 +1000)
The reason is to avoid a theoretically possible overflow of cilen.
Using u_int32_t rather than u_short probably generates better code
on many machines anyway.  Also change l from int to unsigned so as
to avoid any possibility of integer overflow.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
pppd/ipcp.c

index 5d9ff11e30a444c1f902f82a40a507771d01d65c..1cf7f79bceb9ac53d6a60333080723fb6a7e3fc0 100644 (file)
@@ -1437,14 +1437,14 @@ ipcp_reqci(fsm *f, u_char *inp, int *len, int reject_if_disagree)
     ipcp_options *ho = &ipcp_hisoptions[f->unit];
     ipcp_options *ao = &ipcp_allowoptions[f->unit];
     u_char *cip, *next;                /* Pointer to current and next CIs */
-    u_short cilen, citype;     /* Parsed len, type */
+    u_int32_t cilen, citype;   /* Parsed len, type */
     u_short cishort;           /* Parsed short value */
     u_int32_t tl, ciaddr1, ciaddr2;/* Parsed address values */
     int rc = CONFACK;          /* Final packet return code */
     int orc;                   /* Individual option return code */
     u_char *p;                 /* Pointer to next char to parse */
     u_char *ucp = inp;         /* Pointer to current output char */
-    int l = *len;              /* Length left */
+    u_int32_t l = *len;                /* Length left */
     u_char maxslotindex, cflag;
     int d;