Submitted by Jon Thacker:
patch #9253: Fix for giving terminal_mode commands more than 20 arguments * term.c (tokenize): fix realloc usage, pointer returned not necessarily the same as pointer passed git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1471 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
db7249bf57
commit
3d1b0ff308
|
@ -1,3 +1,10 @@
|
||||||
|
2021-11-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
|
Submitted by Jon Thacker:
|
||||||
|
patch #9253: Fix for giving terminal_mode commands more than 20 arguments
|
||||||
|
* term.c (tokenize): fix realloc usage, pointer returned not necessarily
|
||||||
|
the same as pointer passed
|
||||||
|
|
||||||
2021-11-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
2021-11-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
Submitted by Martino Facchin:
|
Submitted by Martino Facchin:
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -105,6 +105,7 @@ Current:
|
||||||
patch #10017: uspasp / tpi: Automatically clear configuration byte (fuse) before writing it
|
patch #10017: uspasp / tpi: Automatically clear configuration byte (fuse) before writing it
|
||||||
patch #8957: Allow reading prodsig memory from stk500v2 on xmega devices
|
patch #8957: Allow reading prodsig memory from stk500v2 on xmega devices
|
||||||
patch #9110: Let reserved fuse bits to be read as *don't care*
|
patch #9110: Let reserved fuse bits to be read as *don't care*
|
||||||
|
patch #9253: Fix for giving terminal_mode commands more than 20 arguments
|
||||||
|
|
||||||
* Internals:
|
* Internals:
|
||||||
- New avrdude.conf keyword "family_id", used to verify SIB attributes
|
- New avrdude.conf keyword "family_id", used to verify SIB attributes
|
||||||
|
|
9
term.c
9
term.c
|
@ -780,11 +780,12 @@ static int cmd_verbose(PROGRAMMER * pgm, struct avrpart * p,
|
||||||
|
|
||||||
static int tokenize(char * s, char *** argv)
|
static int tokenize(char * s, char *** argv)
|
||||||
{
|
{
|
||||||
int i, n, l, nargs, offset;
|
int i, n, l, k, nargs, offset;
|
||||||
int len, slen;
|
int len, slen;
|
||||||
char * buf;
|
char * buf;
|
||||||
int bufsize;
|
int bufsize;
|
||||||
char ** bufv;
|
char ** bufv;
|
||||||
|
char * bufp;
|
||||||
char * q, * r;
|
char * q, * r;
|
||||||
char * nbuf;
|
char * nbuf;
|
||||||
char ** av;
|
char ** av;
|
||||||
|
@ -821,9 +822,15 @@ static int tokenize(char * s, char *** argv)
|
||||||
/* realloc space for another 20 args */
|
/* realloc space for another 20 args */
|
||||||
bufsize += 20;
|
bufsize += 20;
|
||||||
nargs += 20;
|
nargs += 20;
|
||||||
|
bufp = buf;
|
||||||
buf = realloc(buf, bufsize);
|
buf = realloc(buf, bufsize);
|
||||||
bufv = realloc(bufv, nargs*sizeof(char *));
|
bufv = realloc(bufv, nargs*sizeof(char *));
|
||||||
nbuf = &buf[l];
|
nbuf = &buf[l];
|
||||||
|
/* correct bufv pointers */
|
||||||
|
k = buf - bufp;
|
||||||
|
for (i=0; i<n; i++) {
|
||||||
|
bufv[i] = bufv[i] + k;
|
||||||
|
}
|
||||||
for (i=n; i<nargs; i++)
|
for (i=n; i<nargs; i++)
|
||||||
bufv[i] = NULL;
|
bufv[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue