diff --git a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c index 410722fd53..947333a14a 100644 --- a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c +++ b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c @@ -1280,7 +1280,7 @@ static FIO_WRITE_FUNCTION(misdn_write) hh->id = MISDN_ID_ANY; /* avoid buffer overflow */ - size = MIN(size, MAX_DATA_MEM); + size = MIN(size, MAX_DATA_MEM - MISDN_HEADER_LEN); memcpy(wbuf + MISDN_HEADER_LEN, data, size); size += MISDN_HEADER_LEN;