Description of problem: The original code uses sprintf to format the string and store it in buf. sprintf does not check the buffer size, so if the resulting string exceeds the size of buf (64 bytes), a buffer overflow will occur. Buffer overflows corrupt memory data and may cause program crashes or other unpredictable behavior. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1.Replace sprintf with snprintf and specify the buffer size sizeof(buf). snprintf will check the buffer size when formatting the string to ensure that no data exceeding the buffer size is written to avoid buffer overflow. Actual results: Expected results: Additional info:
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3229