mirror of
https://repo.or.cz/socat.git
synced 2025-07-10 22:13:00 +00:00
Fixed possible integer overflow with option -b
This commit is contained in:
parent
0c65370ae5
commit
8e6b341f59
4 changed files with 66 additions and 2 deletions
4
socat.c
4
socat.c
|
@ -779,6 +779,10 @@ int _socat(void) {
|
|||
#endif /* WITH_FILAN */
|
||||
|
||||
/* when converting nl to crnl, size might double */
|
||||
if (socat_opts.bufsiz > (SIZE_MAX-1)/2) {
|
||||
Error2("buffer size option (-b) to big - "F_Zu" (max is "F_Zu")", socat_opts.bufsiz, (SIZE_MAX-1)/2);
|
||||
socat_opts.bufsiz = (SIZE_MAX-1)/2;
|
||||
}
|
||||
buff = Malloc(2*socat_opts.bufsiz+1);
|
||||
if (buff == NULL) return -1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue