mirror of
https://github.com/cclassic/model-ghdl
synced 2024-11-22 08:35:05 +01:00
[vcom] Buffer overflow protection
This commit is contained in:
parent
1df04509a4
commit
f304d611a8
5
main.c
5
main.c
@ -105,11 +105,10 @@ int run_ghdl(char *command, ...) {
|
|||||||
while(42){
|
while(42){
|
||||||
ptr = buf - 1;
|
ptr = buf - 1;
|
||||||
|
|
||||||
|
do {
|
||||||
do { // TODO: Overflow protection!
|
|
||||||
ptr++;
|
ptr++;
|
||||||
*ptr = fgetc(proc);
|
*ptr = fgetc(proc);
|
||||||
} while (*ptr != '\0' && *ptr != '\n' && *ptr != -1);
|
} while (*ptr != '\0' && *ptr != '\n' && *ptr != -1 && ptr < buf + sizeof(buf));
|
||||||
if (*ptr == -1)
|
if (*ptr == -1)
|
||||||
break;
|
break;
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user