FreeCalypso > hg > freecalypso-sw
comparison loadtools/ltdispatch.c @ 57:10996c267de4
loadtools old buglet: off by 1 error in the max-arguments logic in cmd parsing
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 24 Jun 2013 05:24:19 +0000 |
parents | b015036286f3 |
children | 1f9302b6f342 |
comparison
equal
deleted
inserted
replaced
56:d98137625c0d | 57:10996c267de4 |
---|---|
67 for (ap = argv + 1; ; ) { | 67 for (ap = argv + 1; ; ) { |
68 while (isspace(*cp)) | 68 while (isspace(*cp)) |
69 cp++; | 69 cp++; |
70 if (!*cp || *cp == '#') | 70 if (!*cp || *cp == '#') |
71 break; | 71 break; |
72 if (ap - argv - 1 > tp->maxargs) { | 72 if (ap - argv - 1 >= tp->maxargs) { |
73 fprintf(stderr, "error: too many arguments\n"); | 73 fprintf(stderr, "error: too many arguments\n"); |
74 return(-1); | 74 return(-1); |
75 } | 75 } |
76 *ap++ = cp; | 76 *ap++ = cp; |
77 while (*cp && !isspace(*cp)) | 77 while (*cp && !isspace(*cp)) |