diff options
| author | Mario Domenech Goulart <mario@ossystems.com.br> | 2015-03-10 18:10:20 -0300 |
|---|---|---|
| committer | Otavio Salvador <otavio@ossystems.com.br> | 2015-03-11 10:43:53 -0300 |
| commit | a3ede8721f19af849c6a23e3f8e60485ef9f30df (patch) | |
| tree | 21bbd62543d69e3dff1d02c8e728ca5155b14de0 | |
| parent | bd9c60238c4c62d9a0f2d60b89aef429a1b71e34 (diff) | |
| download | meta-java-a3ede8721f19af849c6a23e3f8e60485ef9f30df.tar.gz | |
rxtx: update to the latest Debian patchset
Update the recipe to apply all patches available from
git://anonscm.debian.org/pkg-java/rxtx.git as of
a4cd13e04254cea7842df2e30e9d12e9765a3ef9.
Signed-off-by: Mario Domenech Goulart <mario@ossystems.com.br>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
| -rw-r--r-- | recipes-extended/rxtx/files/MonitorThread-daemon.patch | 66 | ||||
| -rw-r--r-- | recipes-extended/rxtx/files/fhs_lock_buffer_overflow_fix.patch | 66 | ||||
| -rw-r--r-- | recipes-extended/rxtx/files/fix_snprintf.patch | 399 | ||||
| -rw-r--r-- | recipes-extended/rxtx/files/format_security.patch | 112 | ||||
| -rw-r--r-- | recipes-extended/rxtx/files/kfreebsd_port.patch | 7 | ||||
| -rw-r--r-- | recipes-extended/rxtx/files/usb_38400.patch | 68 | ||||
| -rw-r--r-- | recipes-extended/rxtx/rxtx_2.2.0.bb | 7 |
7 files changed, 724 insertions, 1 deletions
diff --git a/recipes-extended/rxtx/files/MonitorThread-daemon.patch b/recipes-extended/rxtx/files/MonitorThread-daemon.patch new file mode 100644 index 0000000..8e7951a --- /dev/null +++ b/recipes-extended/rxtx/files/MonitorThread-daemon.patch | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | Description: Threads created in Java by RXTX are not marked as daemon. | ||
| 2 | Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674975 | ||
| 3 | Author: Christopher Wellons <mosquitopsu@gmail.com> | ||
| 4 | Upstream-Status: Pending | ||
| 5 | --- a/src/gnu/io/I2C.java | ||
| 6 | +++ b/src/gnu/io/I2C.java | ||
| 7 | @@ -468,7 +468,9 @@ | ||
| 8 | private boolean BI=false; | ||
| 9 | private boolean Data=false; | ||
| 10 | private boolean Output=false; | ||
| 11 | - MonitorThread() { } | ||
| 12 | + MonitorThread() { | ||
| 13 | + setDaemon(true); | ||
| 14 | + } | ||
| 15 | public void run() { | ||
| 16 | eventLoop(); | ||
| 17 | } | ||
| 18 | --- a/src/gnu/io/LPRPort.java | ||
| 19 | +++ b/src/gnu/io/LPRPort.java | ||
| 20 | @@ -366,7 +366,9 @@ | ||
| 21 | { | ||
| 22 | private boolean monError = false; | ||
| 23 | private boolean monBuffer = false; | ||
| 24 | - MonitorThread() { } | ||
| 25 | + MonitorThread() { | ||
| 26 | + setDaemon(true); | ||
| 27 | + } | ||
| 28 | public void run() | ||
| 29 | { | ||
| 30 | eventLoop(); | ||
| 31 | --- a/src/gnu/io/RS485.java | ||
| 32 | +++ b/src/gnu/io/RS485.java | ||
| 33 | @@ -465,7 +465,9 @@ | ||
| 34 | private boolean BI=false; | ||
| 35 | private boolean Data=false; | ||
| 36 | private boolean Output=false; | ||
| 37 | - MonitorThread() { } | ||
| 38 | + MonitorThread() { | ||
| 39 | + setDaemon(true); | ||
| 40 | + } | ||
| 41 | public void run() { | ||
| 42 | eventLoop(); | ||
| 43 | } | ||
| 44 | --- a/src/gnu/io/RXTXPort.java | ||
| 45 | +++ b/src/gnu/io/RXTXPort.java | ||
| 46 | @@ -1629,6 +1629,7 @@ | ||
| 47 | |||
| 48 | MonitorThread() | ||
| 49 | { | ||
| 50 | + setDaemon(true); | ||
| 51 | if (debug) | ||
| 52 | z.reportln( "RXTXPort:MontitorThread:MonitorThread()"); | ||
| 53 | } | ||
| 54 | --- a/src/gnu/io/Raw.java | ||
| 55 | +++ b/src/gnu/io/Raw.java | ||
| 56 | @@ -466,7 +466,9 @@ | ||
| 57 | private boolean BI=false; | ||
| 58 | private boolean Data=false; | ||
| 59 | private boolean Output=false; | ||
| 60 | - MonitorThread() { } | ||
| 61 | + MonitorThread() { | ||
| 62 | + setDaemon(true); | ||
| 63 | + } | ||
| 64 | public void run() { | ||
| 65 | eventLoop(); | ||
| 66 | } | ||
diff --git a/recipes-extended/rxtx/files/fhs_lock_buffer_overflow_fix.patch b/recipes-extended/rxtx/files/fhs_lock_buffer_overflow_fix.patch new file mode 100644 index 0000000..c4d0e89 --- /dev/null +++ b/recipes-extended/rxtx/files/fhs_lock_buffer_overflow_fix.patch | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | Description: Java fails with a buffer overflow when there's a locked serial | ||
| 2 | device, see http://mailman.qbang.org/pipermail/rxtx/2009-May/10897125.html. | ||
| 3 | Author: Sergio Talens-Oliag <sto@debian.org> | ||
| 4 | Upstream-Status: Pending | ||
| 5 | |||
| 6 | Index: rxtx-2.2pre2/CNI/SerialImp.c | ||
| 7 | =================================================================== | ||
| 8 | --- rxtx-2.2pre2.orig/CNI/SerialImp.c 2012-05-21 13:13:43.000000000 +0200 | ||
| 9 | +++ rxtx-2.2pre2/CNI/SerialImp.c 2012-05-21 13:24:05.876652630 +0200 | ||
| 10 | @@ -4752,7 +4752,7 @@ | ||
| 11 | fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 ); | ||
| 12 | if( fd < 0 ) | ||
| 13 | { | ||
| 14 | - sprintf( message, | ||
| 15 | + snprintf( message, 79, | ||
| 16 | "RXTX fhs_lock() Error: creating lock file: %s: %s\n", | ||
| 17 | file, strerror(errno) ); | ||
| 18 | report_error( message ); | ||
| 19 | Index: rxtx-2.2pre2/src/SerialImp.c | ||
| 20 | =================================================================== | ||
| 21 | --- rxtx-2.2pre2.orig/src/SerialImp.c 2012-05-21 13:13:43.000000000 +0200 | ||
| 22 | +++ rxtx-2.2pre2/src/SerialImp.c 2012-05-21 13:26:50.184644233 +0200 | ||
| 23 | @@ -5307,7 +5307,7 @@ | ||
| 24 | } | ||
| 25 | if ( dev_lock( filename ) ) | ||
| 26 | { | ||
| 27 | - sprintf( message, | ||
| 28 | + snprintf( message, 79, | ||
| 29 | "RXTX fhs_lock() Error: creating lock file for: %s: %s\n", | ||
| 30 | filename, strerror(errno) ); | ||
| 31 | report_error( message ); | ||
| 32 | @@ -5367,7 +5367,7 @@ | ||
| 33 | fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 ); | ||
| 34 | if( fd < 0 ) | ||
| 35 | { | ||
| 36 | - sprintf( message, | ||
| 37 | + snprintf( message, 79, | ||
| 38 | "RXTX fhs_lock() Error: creating lock file: %s: %s\n", | ||
| 39 | file, strerror(errno) ); | ||
| 40 | report_error( message ); | ||
| 41 | Index: rxtx-2.2pre2/src/lfd/lockdaemon.c | ||
| 42 | =================================================================== | ||
| 43 | --- rxtx-2.2pre2.orig/src/lfd/lockdaemon.c 2007-04-26 07:26:07.000000000 +0200 | ||
| 44 | +++ rxtx-2.2pre2/src/lfd/lockdaemon.c 2012-05-21 13:25:35.396648055 +0200 | ||
| 45 | @@ -145,7 +145,7 @@ | ||
| 46 | fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 ); | ||
| 47 | if( fd < 0 ) | ||
| 48 | { | ||
| 49 | - sprintf( message, | ||
| 50 | + snprintf( message, 79, | ||
| 51 | "RXTX fhs_lock() Error: creating lock file: %s: %s\n", | ||
| 52 | file, strerror(errno) ); | ||
| 53 | syslog( LOG_INFO, message ); | ||
| 54 | Index: rxtx-2.2pre2/src/lfd/lockdaemon.c.noinetd | ||
| 55 | =================================================================== | ||
| 56 | --- rxtx-2.2pre2.orig/src/lfd/lockdaemon.c.noinetd 2007-04-26 07:26:07.000000000 +0200 | ||
| 57 | +++ rxtx-2.2pre2/src/lfd/lockdaemon.c.noinetd 2012-05-21 13:25:55.748647017 +0200 | ||
| 58 | @@ -144,7 +144,7 @@ | ||
| 59 | fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 ); | ||
| 60 | if( fd < 0 ) | ||
| 61 | { | ||
| 62 | - sprintf( message, | ||
| 63 | + snprintf( message, 79, | ||
| 64 | "RXTX fhs_lock() Error: creating lock file: %s: %s\n", | ||
| 65 | file, strerror(errno) ); | ||
| 66 | syslog( LOG_INFO, message ); | ||
diff --git a/recipes-extended/rxtx/files/fix_snprintf.patch b/recipes-extended/rxtx/files/fix_snprintf.patch new file mode 100644 index 0000000..704a2c4 --- /dev/null +++ b/recipes-extended/rxtx/files/fix_snprintf.patch | |||
| @@ -0,0 +1,399 @@ | |||
| 1 | From: Jose Luis Guardiola <guardiola@iti.upv.es> | ||
| 2 | Forwarded: no | ||
| 3 | Description: replace s[n]printf with asprintf/free | ||
| 4 | Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731151 | ||
| 5 | Upstream-Status: Pending | ||
| 6 | |||
| 7 | --- a/src/SerialImp.c | ||
| 8 | +++ b/src/SerialImp.c | ||
| 9 | @@ -5827,7 +5827,7 @@ | ||
| 10 | LOCKDIR, NULL | ||
| 11 | }; | ||
| 12 | const char *lockprefixes[] = { "LCK..", "lk..", "LK.", NULL }; | ||
| 13 | - char *p, file[80], pid_buffer[20], message[80]; | ||
| 14 | + char *p, *file, pid_buffer[20], *message; | ||
| 15 | int i = 0, j, k, fd , pid; | ||
| 16 | struct stat buf, buf2, lockbuf; | ||
| 17 | |||
| 18 | @@ -5868,19 +5868,22 @@ | ||
| 19 | while ( lockprefixes[k] ) | ||
| 20 | { | ||
| 21 | /* FHS style */ | ||
| 22 | - sprintf( file, "%s/%s%s", lockdirs[i], | ||
| 23 | + asprintf( &file, "%s/%s%s", lockdirs[i], | ||
| 24 | lockprefixes[k], p ); | ||
| 25 | if( stat( file, &buf ) == 0 ) | ||
| 26 | { | ||
| 27 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 28 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 29 | file ); | ||
| 30 | report_warning( message ); | ||
| 31 | + free( message ); | ||
| 32 | + free( file ); | ||
| 33 | return 1; | ||
| 34 | } | ||
| 35 | + free( file ); | ||
| 36 | |||
| 37 | /* UUCP style */ | ||
| 38 | stat(port_filename , &buf ); | ||
| 39 | - sprintf( file, "%s/%s%03d.%03d.%03d", | ||
| 40 | + asprintf( &file, "%s/%s%03d.%03d.%03d", | ||
| 41 | lockdirs[i], | ||
| 42 | lockprefixes[k], | ||
| 43 | (int) major( buf.st_dev ), | ||
| 44 | @@ -5889,11 +5892,14 @@ | ||
| 45 | ); | ||
| 46 | if( stat( file, &buf ) == 0 ) | ||
| 47 | { | ||
| 48 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 49 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 50 | file ); | ||
| 51 | report_warning( message ); | ||
| 52 | + free( message ); | ||
| 53 | + free( file ); | ||
| 54 | return 1; | ||
| 55 | } | ||
| 56 | + free( file ); | ||
| 57 | k++; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | @@ -5917,7 +5923,7 @@ | ||
| 61 | #endif /* __unixware__ */ | ||
| 62 | p--; | ||
| 63 | } | ||
| 64 | - sprintf( file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 65 | + asprintf( &file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 66 | #else | ||
| 67 | /* UUCP standard locks */ | ||
| 68 | if ( stat( port_filename, &buf ) != 0 ) | ||
| 69 | @@ -5925,7 +5931,7 @@ | ||
| 70 | report( "RXTX is_device_locked() could not find device.\n" ); | ||
| 71 | return 1; | ||
| 72 | } | ||
| 73 | - sprintf( file, "%s/LK.%03d.%03d.%03d", | ||
| 74 | + asprintf( &file, "%s/LK.%03d.%03d.%03d", | ||
| 75 | LOCKDIR, | ||
| 76 | (int) major( buf.st_dev ), | ||
| 77 | (int) major( buf.st_rdev ), | ||
| 78 | @@ -5946,21 +5952,25 @@ | ||
| 79 | |||
| 80 | if( kill( (pid_t) pid, 0 ) && errno==ESRCH ) | ||
| 81 | { | ||
| 82 | - sprintf( message, | ||
| 83 | + asprintf( &message, | ||
| 84 | "RXTX Warning: Removing stale lock file. %s\n", | ||
| 85 | file ); | ||
| 86 | report_warning( message ); | ||
| 87 | + free( message ); | ||
| 88 | if( unlink( file ) != 0 ) | ||
| 89 | { | ||
| 90 | - snprintf( message, 80, "RXTX Error: Unable to \ | ||
| 91 | + asprintf( &message, "RXTX Error: Unable to \ | ||
| 92 | remove stale lock file: %s\n", | ||
| 93 | file | ||
| 94 | ); | ||
| 95 | report_warning( message ); | ||
| 96 | + free( message ); | ||
| 97 | + free( file ); | ||
| 98 | return 1; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
| 102 | + free(file); | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | #endif /* WIN32 */ | ||
| 106 | --- a/src/lfd/lockdaemon.c | ||
| 107 | +++ b/src/lfd/lockdaemon.c | ||
| 108 | @@ -120,8 +120,8 @@ | ||
| 109 | * | ||
| 110 | */ | ||
| 111 | int fd,j; | ||
| 112 | - char lockinfo[12], message[80]; | ||
| 113 | - char file[80], *p; | ||
| 114 | + char lockinfo[12]; | ||
| 115 | + char *file, *p, *message; | ||
| 116 | |||
| 117 | j = strlen( filename ); | ||
| 118 | p = ( char * ) filename + j; | ||
| 119 | @@ -136,24 +136,28 @@ | ||
| 120 | #endif /* __unixware__ */ | ||
| 121 | p--; | ||
| 122 | } | ||
| 123 | - sprintf( file, "%s/LCK..%s", LOCKDIR, p ); | ||
| 124 | if ( check_lock_status( filename ) ) | ||
| 125 | { | ||
| 126 | /* syslog( LOG_INFO, "fhs_lock() lockstatus fail\n" ); */ | ||
| 127 | return 1; | ||
| 128 | } | ||
| 129 | + asprintf( &file, "%s/LCK..%s", LOCKDIR, p ); | ||
| 130 | fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 ); | ||
| 131 | if( fd < 0 ) | ||
| 132 | { | ||
| 133 | - snprintf( message, 79, | ||
| 134 | + asprintf( &message, | ||
| 135 | "RXTX fhs_lock() Error: creating lock file: %s: %s\n", | ||
| 136 | file, strerror(errno) ); | ||
| 137 | syslog( LOG_INFO, message ); | ||
| 138 | + free(message); | ||
| 139 | + free(file); | ||
| 140 | return 1; | ||
| 141 | } | ||
| 142 | sprintf( lockinfo, "%10d\n", pid ); | ||
| 143 | - sprintf( message, "fhs_lock: creating lockfile: %s\n", lockinfo ); | ||
| 144 | + //asprintf( &message, "fhs_lock: creating lockfile: %s\n", lockinfo ); | ||
| 145 | //syslog( LOG_INFO, message ); | ||
| 146 | + //free(message); | ||
| 147 | + free(file); | ||
| 148 | write( fd, lockinfo, 11 ); | ||
| 149 | close( fd ); | ||
| 150 | return 0; | ||
| 151 | @@ -563,7 +567,7 @@ | ||
| 152 | LOCKDIR, NULL | ||
| 153 | }; | ||
| 154 | const char *lockprefixes[] = { "LCK..", "lk..", "LK.", NULL }; | ||
| 155 | - char *p, file[80], pid_buffer[20], message[80]; | ||
| 156 | + char *p, *file, pid_buffer[20], *message; | ||
| 157 | int i = 0, j, k, fd , pid; | ||
| 158 | struct stat buf; | ||
| 159 | struct stat buf2; | ||
| 160 | @@ -602,19 +606,22 @@ | ||
| 161 | while ( lockprefixes[k] ) | ||
| 162 | { | ||
| 163 | /* FHS style */ | ||
| 164 | - sprintf( file, "%s/%s%s", lockdirs[i], | ||
| 165 | + asprintf( &file, "%s/%s%s", lockdirs[i], | ||
| 166 | lockprefixes[k], p ); | ||
| 167 | if( stat( file, &buf ) == 0 ) | ||
| 168 | { | ||
| 169 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 170 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 171 | file ); | ||
| 172 | syslog( LOG_INFO, message ); | ||
| 173 | + free( message ); | ||
| 174 | + free( file ); | ||
| 175 | return 1; | ||
| 176 | } | ||
| 177 | + free( file ); | ||
| 178 | |||
| 179 | /* UUCP style */ | ||
| 180 | stat(port_filename , &buf ); | ||
| 181 | - sprintf( file, "%s/%s%03d.%03d.%03d", | ||
| 182 | + asprintf( &file, "%s/%s%03d.%03d.%03d", | ||
| 183 | lockdirs[i], | ||
| 184 | lockprefixes[k], | ||
| 185 | (int) major( buf.st_dev ), | ||
| 186 | @@ -623,11 +630,14 @@ | ||
| 187 | ); | ||
| 188 | if( stat( file, &buf ) == 0 ) | ||
| 189 | { | ||
| 190 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 191 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 192 | file ); | ||
| 193 | syslog( LOG_INFO, message ); | ||
| 194 | + free( message ); | ||
| 195 | + free( file ); | ||
| 196 | return 1; | ||
| 197 | } | ||
| 198 | + free( file ); | ||
| 199 | k++; | ||
| 200 | } | ||
| 201 | } | ||
| 202 | @@ -651,10 +661,10 @@ | ||
| 203 | #endif /* __unixware__ */ | ||
| 204 | p--; | ||
| 205 | } | ||
| 206 | - sprintf( file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 207 | + asprintf( &file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 208 | #else | ||
| 209 | /* UUCP standard locks */ | ||
| 210 | - sprintf( file, "%s/LK.%03d.%03d.%03d", | ||
| 211 | + asprintf( &file, "%s/LK.%03d.%03d.%03d", | ||
| 212 | LOCKDIR, | ||
| 213 | (int) major( buf.st_dev ), | ||
| 214 | (int) major( buf.st_rdev ), | ||
| 215 | @@ -672,32 +682,39 @@ | ||
| 216 | /* FIXME null terminiate pid_buffer? need to check in Solaris */ | ||
| 217 | close( fd ); | ||
| 218 | sscanf( pid_buffer, "%d", &pid ); | ||
| 219 | - sprintf( message, "found lock for %s with pid %i\n", file, pid ); | ||
| 220 | + /* asprintf( &message, "found lock for %s with pid %i\n", file, pid ); */ | ||
| 221 | /* syslog( LOG_INFO, message ); */ | ||
| 222 | + /* free( message ); */ | ||
| 223 | |||
| 224 | if( kill( (pid_t) pid, 0 ) && errno==ESRCH ) | ||
| 225 | { | ||
| 226 | - sprintf( message, | ||
| 227 | + asprintf( &message, | ||
| 228 | "RXTX Warning: Removing stale lock file. %s\n", | ||
| 229 | file ); | ||
| 230 | syslog( LOG_INFO, message ); | ||
| 231 | + free( message ); | ||
| 232 | if( unlink( file ) != 0 ) | ||
| 233 | { | ||
| 234 | - snprintf( message, 80, "RXTX Error: Unable to \ | ||
| 235 | + asprintf( &message, "RXTX Error: Unable to \ | ||
| 236 | remove stale lock file: %s\n", | ||
| 237 | file | ||
| 238 | ); | ||
| 239 | syslog( LOG_INFO, message ); | ||
| 240 | + free( message ); | ||
| 241 | + free( file ); | ||
| 242 | return 0; | ||
| 243 | } | ||
| 244 | } | ||
| 245 | else | ||
| 246 | { | ||
| 247 | - sprintf( message, "could not kill %i\n", pid ); | ||
| 248 | + /* asprintf( &message, "could not kill %i\n", pid ); */ | ||
| 249 | /* syslog( LOG_INFO, message ); */ | ||
| 250 | + /* free( message ); */ | ||
| 251 | + free( file ); | ||
| 252 | return 1; | ||
| 253 | } | ||
| 254 | } | ||
| 255 | + free( file ); | ||
| 256 | return 0; | ||
| 257 | } | ||
| 258 | int init( void ) | ||
| 259 | --- a/src/lfd/lockdaemon.c.noinetd | ||
| 260 | +++ b/src/lfd/lockdaemon.c.noinetd | ||
| 261 | @@ -119,8 +119,8 @@ | ||
| 262 | * | ||
| 263 | */ | ||
| 264 | int fd,j; | ||
| 265 | - char lockinfo[12], message[80]; | ||
| 266 | - char file[80], *p; | ||
| 267 | + char lockinfo[12]; | ||
| 268 | + char *file, *p, *message; | ||
| 269 | |||
| 270 | j = strlen( filename ); | ||
| 271 | p = ( char * ) filename + j; | ||
| 272 | @@ -135,24 +135,28 @@ | ||
| 273 | #endif /* __unixware__ */ | ||
| 274 | p--; | ||
| 275 | } | ||
| 276 | - sprintf( file, "%s/LCK..%s", LOCKDIR, p ); | ||
| 277 | if ( check_lock_status( filename ) ) | ||
| 278 | { | ||
| 279 | syslog( LOG_INFO, "fhs_lock() lockstatus fail\n" ); | ||
| 280 | return 1; | ||
| 281 | } | ||
| 282 | + asprintf( &file, "%s/LCK..%s", LOCKDIR, p ); | ||
| 283 | fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 ); | ||
| 284 | if( fd < 0 ) | ||
| 285 | { | ||
| 286 | - snprintf( message, 79, | ||
| 287 | + asprintf( &message, | ||
| 288 | "RXTX fhs_lock() Error: creating lock file: %s: %s\n", | ||
| 289 | file, strerror(errno) ); | ||
| 290 | syslog( LOG_INFO, message ); | ||
| 291 | + free(message); | ||
| 292 | + free(file); | ||
| 293 | return 1; | ||
| 294 | } | ||
| 295 | sprintf( lockinfo, "%10d\n", pid ); | ||
| 296 | - sprintf( message, "fhs_lock: creating lockfile: %s\n", lockinfo ); | ||
| 297 | + asprintf( &message, "fhs_lock: creating lockfile: %s\n", lockinfo ); | ||
| 298 | syslog( LOG_INFO, message ); | ||
| 299 | + free( message ); | ||
| 300 | + free( file ); | ||
| 301 | write( fd, lockinfo, 11 ); | ||
| 302 | close( fd ); | ||
| 303 | return 0; | ||
| 304 | @@ -556,7 +560,7 @@ | ||
| 305 | LOCKDIR, NULL | ||
| 306 | }; | ||
| 307 | const char *lockprefixes[] = { "LCK..", "lk..", "LK.", NULL }; | ||
| 308 | - char *p, file[80], pid_buffer[20], message[80]; | ||
| 309 | + char *p, *file, pid_buffer[20], *message; | ||
| 310 | int i = 0, j, k, fd , pid; | ||
| 311 | struct stat buf; | ||
| 312 | struct stat buf2; | ||
| 313 | @@ -595,19 +599,22 @@ | ||
| 314 | while ( lockprefixes[k] ) | ||
| 315 | { | ||
| 316 | /* FHS style */ | ||
| 317 | - sprintf( file, "%s/%s%s", lockdirs[i], | ||
| 318 | + asprintf( &file, "%s/%s%s", lockdirs[i], | ||
| 319 | lockprefixes[k], p ); | ||
| 320 | if( stat( file, &buf ) == 0 ) | ||
| 321 | { | ||
| 322 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 323 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 324 | file ); | ||
| 325 | syslog( LOG_INFO, message ); | ||
| 326 | + free( message ); | ||
| 327 | + free( file ); | ||
| 328 | return 1; | ||
| 329 | } | ||
| 330 | + free( file ); | ||
| 331 | |||
| 332 | /* UUCP style */ | ||
| 333 | stat(port_filename , &buf ); | ||
| 334 | - sprintf( file, "%s/%s%03d.%03d.%03d", | ||
| 335 | + asprintf( &file, "%s/%s%03d.%03d.%03d", | ||
| 336 | lockdirs[i], | ||
| 337 | lockprefixes[k], | ||
| 338 | (int) major( buf.st_dev ), | ||
| 339 | @@ -616,11 +623,14 @@ | ||
| 340 | ); | ||
| 341 | if( stat( file, &buf ) == 0 ) | ||
| 342 | { | ||
| 343 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 344 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 345 | file ); | ||
| 346 | syslog( LOG_INFO, message ); | ||
| 347 | + free( message ); | ||
| 348 | + free( file ); | ||
| 349 | return 1; | ||
| 350 | } | ||
| 351 | + free( file ); | ||
| 352 | k++; | ||
| 353 | } | ||
| 354 | } | ||
| 355 | @@ -644,7 +654,7 @@ | ||
| 356 | #endif /* __unixware__ */ | ||
| 357 | p--; | ||
| 358 | } | ||
| 359 | - sprintf( file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 360 | + asprintf( &file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 361 | #else | ||
| 362 | /* UUCP standard locks */ | ||
| 363 | if ( stat( port_filename, &buf ) != 0 ) | ||
| 364 | @@ -656,7 +666,7 @@ | ||
| 365 | syslog( LOG_INFO, message ); | ||
| 366 | return 1; | ||
| 367 | } | ||
| 368 | - sprintf( file, "%s/LK.%03d.%03d.%03d", | ||
| 369 | + asprintf( &file, "%s/LK.%03d.%03d.%03d", | ||
| 370 | LOCKDIR, | ||
| 371 | (int) major( buf.st_dev ), | ||
| 372 | (int) major( buf.st_rdev ), | ||
| 373 | @@ -677,10 +687,11 @@ | ||
| 374 | |||
| 375 | if( kill( (pid_t) pid, 0 ) && errno==ESRCH ) | ||
| 376 | { | ||
| 377 | - sprintf( message, | ||
| 378 | + asprintf( &message, | ||
| 379 | "RXTX Warning: Removing stale lock file. %s\n", | ||
| 380 | file ); | ||
| 381 | syslog( LOG_INFO, message ); | ||
| 382 | + free( message ); | ||
| 383 | if( unlink( file ) != 0 ) | ||
| 384 | { | ||
| 385 | snprintf( message, 80, "RXTX Error: Unable to \ | ||
| 386 | @@ -688,10 +699,13 @@ | ||
| 387 | file | ||
| 388 | ); | ||
| 389 | syslog( LOG_INFO, message ); | ||
| 390 | + free( message ); | ||
| 391 | + free( file ); | ||
| 392 | return 1; | ||
| 393 | } | ||
| 394 | } | ||
| 395 | } | ||
| 396 | + free( file ); | ||
| 397 | return 0; | ||
| 398 | } | ||
| 399 | int init( void ) | ||
diff --git a/recipes-extended/rxtx/files/format_security.patch b/recipes-extended/rxtx/files/format_security.patch new file mode 100644 index 0000000..bd074ad --- /dev/null +++ b/recipes-extended/rxtx/files/format_security.patch | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | From: tony mancill <tmancill@debian.org> | ||
| 2 | Forwarded: no | ||
| 3 | Description: use format specifiers in fprintf statements for hardening flags | ||
| 4 | Upstream-Status: Pending | ||
| 5 | |||
| 6 | --- a/src/SerialImp.c | ||
| 7 | +++ b/src/SerialImp.c | ||
| 8 | @@ -5108,7 +5108,7 @@ | ||
| 9 | void report_warning(const char *msg) | ||
| 10 | { | ||
| 11 | #ifndef DEBUG_MW | ||
| 12 | - fprintf(stderr, msg); | ||
| 13 | + fprintf(stderr, "%s", msg); | ||
| 14 | #else | ||
| 15 | mexWarnMsgTxt( (const char *) msg ); | ||
| 16 | #endif /* DEBUG_MW */ | ||
| 17 | @@ -5129,7 +5129,7 @@ | ||
| 18 | #ifdef DEBUG_MW | ||
| 19 | mexErrMsgTxt( msg ); | ||
| 20 | #else | ||
| 21 | - fprintf(stderr, msg); | ||
| 22 | + fprintf(stderr, "%s", msg); | ||
| 23 | #endif /* DEBUG_MW */ | ||
| 24 | #endif /* DEBUG_VERBOSE */ | ||
| 25 | } | ||
| 26 | @@ -5145,7 +5145,7 @@ | ||
| 27 | void report_error(const char *msg) | ||
| 28 | { | ||
| 29 | #ifndef DEBUG_MW | ||
| 30 | - fprintf(stderr, msg); | ||
| 31 | + fprintf(stderr, "%s", msg); | ||
| 32 | #else | ||
| 33 | mexWarnMsgTxt( msg ); | ||
| 34 | #endif /* DEBUG_MW */ | ||
| 35 | @@ -5164,7 +5164,7 @@ | ||
| 36 | { | ||
| 37 | #ifdef DEBUG | ||
| 38 | # ifndef DEBUG_MW | ||
| 39 | - fprintf(stderr, msg); | ||
| 40 | + fprintf(stderr, "%s", msg); | ||
| 41 | # else | ||
| 42 | mexPrintf( msg ); | ||
| 43 | # endif /* DEBUG_MW */ | ||
| 44 | --- a/src/ParallelImp.c | ||
| 45 | +++ b/src/ParallelImp.c | ||
| 46 | @@ -920,7 +920,7 @@ | ||
| 47 | void report_error(char *msg) | ||
| 48 | { | ||
| 49 | #ifndef DEBUG_MW | ||
| 50 | - fprintf(stderr, msg); | ||
| 51 | + fprintf(stderr, "%s", msg); | ||
| 52 | #else | ||
| 53 | mexWarnMsgTxt( msg ); | ||
| 54 | #endif /* DEBUG_MW */ | ||
| 55 | @@ -938,7 +938,7 @@ | ||
| 56 | void report(char *msg) | ||
| 57 | { | ||
| 58 | #ifdef DEBUG | ||
| 59 | - fprintf(stderr, msg); | ||
| 60 | + fprintf(stderr, "%s", msg); | ||
| 61 | #endif /* DEBUG */ | ||
| 62 | } | ||
| 63 | |||
| 64 | --- a/src/SerialImp.cpp | ||
| 65 | +++ b/src/SerialImp.cpp | ||
| 66 | @@ -1844,7 +1844,7 @@ | ||
| 67 | |||
| 68 | |||
| 69 | #ifdef DEBUG | ||
| 70 | - fprintf(stderr, msg); | ||
| 71 | + fprintf(stderr, "%s", msg); | ||
| 72 | #endif | ||
| 73 | } | ||
| 74 | |||
| 75 | --- a/CNI/SerialImp.c | ||
| 76 | +++ b/CNI/SerialImp.c | ||
| 77 | @@ -4549,7 +4549,7 @@ | ||
| 78 | void report_warning(char *msg) | ||
| 79 | { | ||
| 80 | #ifndef DEBUG_MW | ||
| 81 | - fprintf(stderr, msg); | ||
| 82 | + fprintf(stderr, "%s", msg); | ||
| 83 | #else | ||
| 84 | mexWarnMsgTxt( (const char *) msg ); | ||
| 85 | #endif /* DEBUG_MW */ | ||
| 86 | @@ -4570,7 +4570,7 @@ | ||
| 87 | #ifdef DEBUG_MW | ||
| 88 | mexErrMsgTxt( msg ); | ||
| 89 | #else | ||
| 90 | - fprintf(stderr, msg); | ||
| 91 | + fprintf(stderr, "%s", msg); | ||
| 92 | #endif /* DEBUG_MW */ | ||
| 93 | #endif /* DEBUG_VERBOSE */ | ||
| 94 | } | ||
| 95 | @@ -4586,7 +4586,7 @@ | ||
| 96 | void report_error(char *msg) | ||
| 97 | { | ||
| 98 | #ifndef DEBUG_MW | ||
| 99 | - fprintf(stderr, msg); | ||
| 100 | + fprintf(stderr, "%s", msg); | ||
| 101 | #else | ||
| 102 | mexWarnMsgTxt( msg ); | ||
| 103 | #endif /* DEBUG_MW */ | ||
| 104 | @@ -4605,7 +4605,7 @@ | ||
| 105 | { | ||
| 106 | #ifdef DEBUG | ||
| 107 | # ifndef DEBUG_MW | ||
| 108 | - fprintf(stderr, msg); | ||
| 109 | + fprintf(stderr, "%s", msg); | ||
| 110 | # else | ||
| 111 | mexPrintf( msg ); | ||
| 112 | # endif /* DEBUG_MW */ | ||
diff --git a/recipes-extended/rxtx/files/kfreebsd_port.patch b/recipes-extended/rxtx/files/kfreebsd_port.patch index b5fa172..a05e40a 100644 --- a/recipes-extended/rxtx/files/kfreebsd_port.patch +++ b/recipes-extended/rxtx/files/kfreebsd_port.patch | |||
| @@ -1,7 +1,14 @@ | |||
| 1 | Description: Defines FreeBSD for kFreeBSD systems, also makes sure kfreeBSD is set to use FHS | 1 | Description: Defines FreeBSD for kFreeBSD systems, also makes sure kfreeBSD is set to use FHS |
| 2 | |||
| 2 | #grep -r -H "__FreeBSD" . -m 1 --exclude=*.patch --exclude-dir=.git | cut -d: -f1 | xargs sed -i s/__FreeBSD__/__FreeBSD_kernel__/ | 3 | #grep -r -H "__FreeBSD" . -m 1 --exclude=*.patch --exclude-dir=.git | cut -d: -f1 | xargs sed -i s/__FreeBSD__/__FreeBSD_kernel__/ |
| 4 | |||
| 5 | #grep -r -H "ifdef __linux__" . -m 1 --exclude=*.patch --exclude-dir=.git | cut -d: -f1 | xargs sed -i s/'#ifdef __linux__'/'#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)'/ | ||
| 6 | |||
| 7 | #grep -r -H "ifndef __linux__" . -m 1 --exclude=*.patch --exclude-dir=.git | cut -d: -f1 | xargs sed -i s/'#ifndef __linux__'/'#if !defined(__linux__) \&\& !defined(__GNU__) \&\& !defined(__GLIBC__)'/ | ||
| 8 | |||
| 3 | Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=585089 | 9 | Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=585089 |
| 4 | Author: Scott Howard <showard@debian.org> | 10 | Author: Scott Howard <showard@debian.org> |
| 11 | Upstream-Status: Pending | ||
| 5 | 12 | ||
| 6 | Index: rxtx/src/RS485Imp.c | 13 | Index: rxtx/src/RS485Imp.c |
| 7 | =================================================================== | 14 | =================================================================== |
diff --git a/recipes-extended/rxtx/files/usb_38400.patch b/recipes-extended/rxtx/files/usb_38400.patch new file mode 100644 index 0000000..fffe4c5 --- /dev/null +++ b/recipes-extended/rxtx/files/usb_38400.patch | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | From: Jan Niehusmann <jan@gondor.com> | ||
| 2 | Subject: Patch to fix setting USB-serial adapters to 38400 bps | ||
| 3 | Bug-Debian: http://bugs.debian.org/740098 | ||
| 4 | Forwarded: no | ||
| 5 | Description: The following patch should fix the reported issue. | ||
| 6 | . | ||
| 7 | On serial ports not supporting the TIOCGSERIAL/TIOCSSERIAL mechanism, | ||
| 8 | this still means that the custom baud rates do not work, but at least | ||
| 9 | 38400 works, again. | ||
| 10 | . | ||
| 11 | Perhaps an even better fix would be switching to the newer termios2 API, | ||
| 12 | as described here: | ||
| 13 | https://mail.python.org/pipermail/python-list/2012-October/633871.html | ||
| 14 | . | ||
| 15 | That API allows setting custom baud rates on the USB serial adapters I | ||
| 16 | have tested, where TIOCGSERIAL/TIOCSSERIAL was not supported. | ||
| 17 | . | ||
| 18 | But unfortunately, termios2 is not available through glibc, so one would | ||
| 19 | need to call linux-specific ioctls directly, which wouldn't be portable | ||
| 20 | at all, and I don't know how it interacts with the BSD / Hurd ports. | ||
| 21 | . | ||
| 22 | Therefore this is the minimal fix, for now. | ||
| 23 | Upstream-Status: Pending | ||
| 24 | |||
| 25 | --- a/src/SerialImp.c | ||
| 26 | +++ b/src/SerialImp.c | ||
| 27 | @@ -872,10 +872,14 @@ | ||
| 28 | out and select baud rates 38400 then 28800 then 38400, you will get | ||
| 29 | a final baud rate of 28800 because you did not update the divisor. | ||
| 30 | |||
| 31 | + However, if the serial port doesn't support TIOCGSERIAL or custom speeds, | ||
| 32 | + don't fail: In this case, just use B38400 and assume that there is no way | ||
| 33 | + to set a custom speed on this port. | ||
| 34 | + | ||
| 35 | See the next ifdef below for the divisor. | ||
| 36 | */ | ||
| 37 | #if defined(TIOCGSERIAL) | ||
| 38 | - if ( cspeed == B38400 ) | ||
| 39 | + if ( cspeed == B38400 && ioctl( fd, TIOCGSERIAL, &sstruct ) == 0 ) | ||
| 40 | cspeed = 38400; | ||
| 41 | #endif /* TIOCGSERIAL */ | ||
| 42 | if( cfsetispeed( &ttyset, cspeed ) < 0 || | ||
| 43 | @@ -905,10 +909,9 @@ | ||
| 44 | return(1); | ||
| 45 | } | ||
| 46 | sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); | ||
| 47 | - cspeed = B38400; | ||
| 48 | #endif /* TIOCGSERIAL */ | ||
| 49 | - if( cfsetispeed( &ttyset, cspeed ) < 0 || | ||
| 50 | - cfsetospeed( &ttyset, cspeed ) < 0 ) | ||
| 51 | + if( cfsetispeed( &ttyset, B38400 ) < 0 || | ||
| 52 | + cfsetospeed( &ttyset, B38400 ) < 0 ) | ||
| 53 | { | ||
| 54 | /* OK, we tried everything */ | ||
| 55 | report( "nativeSetSerialPortParams: Cannot Set Speed\n" ); | ||
| 56 | @@ -916,8 +919,11 @@ | ||
| 57 | } | ||
| 58 | #if defined(TIOCSSERIAL) | ||
| 59 | /* It is assumed Win32 does this for us */ | ||
| 60 | + /* Ignore errors if the target speed is 38400: In this case, | ||
| 61 | + * just assume TIOCSSERIAL is not supported and custom speeds are | ||
| 62 | + * not available. */ | ||
| 63 | if ( sstruct.baud_base < 1 || | ||
| 64 | - ioctl( fd, TIOCSSERIAL, &sstruct ) < 0 ) | ||
| 65 | + ioctl( fd, TIOCSSERIAL, &sstruct ) < 0 && cspeed != 38400 ) | ||
| 66 | { | ||
| 67 | return( 1 ); | ||
| 68 | } | ||
diff --git a/recipes-extended/rxtx/rxtx_2.2.0.bb b/recipes-extended/rxtx/rxtx_2.2.0.bb index 0d5aa21..ff17e9c 100644 --- a/recipes-extended/rxtx/rxtx_2.2.0.bb +++ b/recipes-extended/rxtx/rxtx_2.2.0.bb | |||
| @@ -13,7 +13,12 @@ SRC_URI = "http://rxtx.qbang.org/pub/rxtx/rxtx-2.2pre2.zip \ | |||
| 13 | file://sys_io_h_check.patch \ | 13 | file://sys_io_h_check.patch \ |
| 14 | file://port_to_hurd.patch \ | 14 | file://port_to_hurd.patch \ |
| 15 | file://multiple_property_dirs.patch \ | 15 | file://multiple_property_dirs.patch \ |
| 16 | file://uninstall_target.patch" | 16 | file://uninstall_target.patch \ |
| 17 | file://fhs_lock_buffer_overflow_fix.patch \ | ||
| 18 | file://MonitorThread-daemon.patch \ | ||
| 19 | file://usb_38400.patch \ | ||
| 20 | file://fix_snprintf.patch \ | ||
| 21 | file://format_security.patch" | ||
| 17 | 22 | ||
| 18 | SRC_URI[md5sum] = "7eedb18e3f33a427e2b0e9be8ce3f94c" | 23 | SRC_URI[md5sum] = "7eedb18e3f33a427e2b0e9be8ce3f94c" |
| 19 | SRC_URI[sha256sum] = "3c30373e760f444def3650c76c5a00ae12fb1d860ec008750d084f4880495b03" | 24 | SRC_URI[sha256sum] = "3c30373e760f444def3650c76c5a00ae12fb1d860ec008750d084f4880495b03" |
