Skip to content

Commit

Permalink
ticket VG-2882
Browse files Browse the repository at this point in the history
adding buffer overflow protection for hep data
  • Loading branch information
rbucek committed Sep 17, 2024
1 parent 02884a0 commit b77c1c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ void cHEP_ProcessData::processData(u_char *data, size_t dataLen) {
if(processed < dataLen) {
hep_buffer.add(data + processed, dataLen - processed);
}
} else {
hep_buffer.add(data, dataLen);
}
} else {
} else if(!hep_buffer.empty()) {
hep_buffer.add(data, dataLen);
if(isCompleteHep(hep_buffer.data(), hep_buffer.data_len())) {
unsigned processed = processHeps(hep_buffer.data(), hep_buffer.data_len());
Expand All @@ -44,6 +46,10 @@ void cHEP_ProcessData::processData(u_char *data, size_t dataLen) {
hep_buffer.removeDataFromLeft(processed);
}
}
if(hep_buffer.size() > 1024 * 1024) {
hep_buffer.clear();
syslog(LOG_NOTICE, "HEP data exceeded the limit of 1MB. Check the HEP data sent.");
}
}
}

Expand Down

0 comments on commit b77c1c7

Please sign in to comment.