source:
npl/system/netkit-ftp/patches/33-netkit-ftp-0.17-token.patch
@
d849d83
Last change on this file since d849d83 was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 1.5 KB |
-
ftp/ruserpass.c
diff -rup netkit-ftp-0.17/ftp/ruserpass.c netkit-ftp-0.17-new/ftp/ruserpass.c
old new static int token(void); 58 58 #define ID 10 59 59 #define MACH 11 60 60 61 static char tokval[100]; 61 #define MAXTOKENLEN 4096 62 static char tokval[MAXTOKENLEN]; 62 63 63 64 static struct toktab { 64 65 const char *tokstr; … … bad: 249 250 return(-1); 250 251 } 251 252 252 static 253 static 253 254 int 254 255 token(void) 255 256 { 256 257 char *cp; 257 258 int c; 258 259 struct toktab *t; 260 size_t toklen = 0; 261 int showwarn = 1; 262 int quote = 0; 259 263 260 264 if (feof(cfile)) 261 265 return (0); … … token(void) 266 270 return (0); 267 271 cp = tokval; 268 272 if (c == '"') { 269 while ((c = getc(cfile)) != EOF && c != '"') { 270 if (c == '\\') 271 c = getc(cfile); 272 *cp++ = c; 273 } 274 } else { 273 quote = 1; 274 } 275 else { 275 276 *cp++ = c; 276 while ((c = getc(cfile)) != EOF 277 && c != '\n' && c != '\t' && c != ' ' && c != ',') { 278 if (c == '\\') 279 c = getc(cfile); 280 *cp++ = c; 277 toklen++; 278 } 279 while ((c = getc(cfile)) != EOF) { 280 if (c == '"') 281 break; 282 if (c == '\\') 283 c = getc(cfile); 284 if (!quote && (c == '\n' || c == '\t' || c == ' ' || c == ',')) 285 break; 286 if (toklen >= MAXTOKENLEN) { 287 if (showwarn) { 288 fprintf(stderr, 289 "Warning: .netrc token too long, will be trunctated to %zd characters\n", 290 toklen); 291 showwarn = 0; 292 } 293 continue; 281 294 } 295 *cp++ = c; 296 toklen++; 282 297 } 298 283 299 *cp = 0; 284 300 if (tokval[0] == 0) 285 301 return (0);
Note: See TracBrowser
for help on using the repository browser.