Private
Public Access
2
0

stability: replace sprintf with snprintf to avoid potential overflows

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
This commit is contained in:
Alex Tereschenko
2017-05-13 18:08:00 +02:00
parent 918e2b18e2
commit 0654183b9a
5 changed files with 7 additions and 7 deletions

View File

@@ -140,7 +140,7 @@ mraa_intel_edison_pinmode_change(int sysfs, int mode)
mraa_result_t ret = MRAA_SUCCESS;
char mode_buf[MAX_MODE_SIZE];
int length = sprintf(mode_buf, "%s%u", useDebugFS ? "mode" : "", mode);
int length = snprintf(mode_buf, MAX_MODE_SIZE, "%s%u", useDebugFS ? "mode" : "", mode);
if (write(modef, mode_buf, length * sizeof(char)) == -1) {
ret = MRAA_ERROR_INVALID_RESOURCE;
}