Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorbjörn Svensson2020-11-04 16:52:51 -0500
committerJonah Graham2020-11-05 20:25:01 -0500
commit60bdeb63cadfed109a609ac855c8f2b20a2f0d8f (patch)
tree9dfca7ed38d7dacb31b7d99040fb32447ae77951
parent7f7a310c0723050f86f4f57ec6c85e61a72e2e97 (diff)
downloadorg.eclipse.cdt-60bdeb63cadfed109a609ac855c8f2b20a2f0d8f.tar.gz
org.eclipse.cdt-60bdeb63cadfed109a609ac855c8f2b20a2f0d8f.tar.xz
org.eclipse.cdt-60bdeb63cadfed109a609ac855c8f2b20a2f0d8f.zip
Bug 568079: Fix potential buffer overflows
Change-Id: I79898944575f895bfe4d99ce2aabaa88ea58d678 Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
-rw-r--r--native/org.eclipse.cdt.native.serial/native_src/serial.c6
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/linux/aarch64/libserial.sobin13744 -> 13744 bytes
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/linux/ppc64le/libserial.sobin71072 -> 71072 bytes
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.sobin13224 -> 13224 bytes
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilibbin13756 -> 13756 bytes
5 files changed, 3 insertions, 3 deletions
diff --git a/native/org.eclipse.cdt.native.serial/native_src/serial.c b/native/org.eclipse.cdt.native.serial/native_src/serial.c
index 53951cda19f..ec42c9bddc2 100644
--- a/native/org.eclipse.cdt.native.serial/native_src/serial.c
+++ b/native/org.eclipse.cdt.native.serial/native_src/serial.c
@@ -53,7 +53,7 @@ static void closeAndthrowIOException(HANDLE handle, JNIEnv *env, const char *msg
#endif
char buff[256];
#ifndef __MINGW32__
- sprintf(buff, "%s: %s", msg, strerror(errno));
+ snprintf(buff, sizeof(buff), "%s: %s", msg, strerror(errno));
close(fd);
#else
sprintf_s(buff, sizeof(buff), "%s (%d)", msg, GetLastError());
@@ -67,7 +67,7 @@ static void closeAndthrowIOException(HANDLE handle, JNIEnv *env, const char *msg
static void throwIOException(JNIEnv *env, const char *msg) {
char buff[256];
#ifndef __MINGW32__
- sprintf(buff, "%s: %s", msg, strerror(errno));
+ snprintf(buff, sizeof(buff), "%s: %s", msg, strerror(errno));
#else
sprintf_s(buff, sizeof(buff), "%s (%d)", msg, GetLastError());
#endif
@@ -82,7 +82,7 @@ JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName,
int fd = open(cportName, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd < 0) {
char msg[256];
- sprintf(msg, "Error opening %s", cportName);
+ snprintf(msg, sizeof(msg), "Error opening %s", cportName);
(*env)->ReleaseStringUTFChars(env, portName, cportName);
throwIOException(env, msg);
return fd;
diff --git a/native/org.eclipse.cdt.native.serial/os/linux/aarch64/libserial.so b/native/org.eclipse.cdt.native.serial/os/linux/aarch64/libserial.so
index f5cc2058d06..cbad242128a 100755
--- a/native/org.eclipse.cdt.native.serial/os/linux/aarch64/libserial.so
+++ b/native/org.eclipse.cdt.native.serial/os/linux/aarch64/libserial.so
Binary files differ
diff --git a/native/org.eclipse.cdt.native.serial/os/linux/ppc64le/libserial.so b/native/org.eclipse.cdt.native.serial/os/linux/ppc64le/libserial.so
index 72b1a3471b2..96a0e104b9a 100755
--- a/native/org.eclipse.cdt.native.serial/os/linux/ppc64le/libserial.so
+++ b/native/org.eclipse.cdt.native.serial/os/linux/ppc64le/libserial.so
Binary files differ
diff --git a/native/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.so b/native/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.so
index 535d0a795c0..8b05efbeced 100755
--- a/native/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.so
+++ b/native/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.so
Binary files differ
diff --git a/native/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilib b/native/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilib
index ff4cbab0bdd..3b98ec3ff00 100755
--- a/native/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilib
+++ b/native/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilib
Binary files differ

Back to the top