Skip to content

Commit 828b5b2

Browse files
mikhailnovstevegrubb
authored andcommitted
Fix BUFFER_OVERFLOW.SPRINTF in zos-remote-plugin.c
Replace sprintf with snprintf to prevent potential buffer overflow when formatting logString buffer. Svace report: Warning: An element of array '&logString[0]' of size 200 is accessed by an index with values in [0, +inf] which may lead to a buffer overflow. Format string: 'Linux (%s): type: %s'. Filled values can have unlimited string length. (CWE120, CWE121, CWE122, CWE124, CWE134, CWE20) Location: zos-remote-plugin.c:227 Co-authored-by: Z.AI GLM-5
1 parent c5bf92d commit 828b5b2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

audisp/plugins/zos-remote/zos-remote-plugin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ push_event(auparse_state_t * au, auparse_cb_event_t cb_event_type,
230230
* We assume the first record type found is the
231231
* 'originating' audit record
232232
*/
233-
sprintf(logString, "Linux (%s): type: %s", node, orig_type);
233+
snprintf(logString, ZOS_REMOTE_LOGSTRING_SIZE, "Linux (%s): type: %s", node, orig_type);
234234
free((void *)node);
235235

236236
/*

0 commit comments

Comments
 (0)