mirror of
https://github.com/cclassic/model-ghdl
synced 2024-11-24 08:45: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){
|
||||
ptr = buf - 1;
|
||||
|
||||
|
||||
do { // TODO: Overflow protection!
|
||||
do {
|
||||
ptr++;
|
||||
*ptr = fgetc(proc);
|
||||
} while (*ptr != '\0' && *ptr != '\n' && *ptr != -1);
|
||||
} while (*ptr != '\0' && *ptr != '\n' && *ptr != -1 && ptr < buf + sizeof(buf));
|
||||
if (*ptr == -1)
|
||||
break;
|
||||
*ptr = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user