Skip to content

Commit 74ae9d4

Browse files
committed
fix:add event line truncation validation in readEventData()
1 parent 42e75c1 commit 74ae9d4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/sipnet/events.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ EventNode *readEventData(char *eventFile) {
198198
return newEvents;
199199
}
200200

201-
// Check if line was truncated
201+
// Check for line truncation
202202
size_t len = strlen(line);
203203
if (len == EVENT_LINE_SIZE - 1 && line[len - 1] != '\n') {
204204
logError("Event line too long (exceeds %d chars), data may be truncated\n",
@@ -227,10 +227,11 @@ EventNode *readEventData(char *eventFile) {
227227

228228
while (fgets(line, EVENT_LINE_SIZE, in) != NULL) {
229229
// Check if line was truncated
230-
size_t len = strlen(line);
230+
len = strlen(line);
231231
if (len == EVENT_LINE_SIZE - 1 && line[len - 1] != '\n') {
232-
logError("Event line too long (exceeds %d chars), data may be truncated\n",
233-
EVENT_LINE_SIZE);
232+
logError(
233+
"Event line too long (exceeds %d chars), data may be truncated\n",
234+
EVENT_LINE_SIZE);
234235
exit(EXIT_CODE_INPUT_FILE_ERROR);
235236
}
236237
// We have another event

0 commit comments

Comments
 (0)