AddressSanitizer reported a few buffer overflows (false positives)

This commit is contained in:
Gerhard Rieger 2017-01-06 17:56:30 +01:00
parent 40d9352599
commit e25ba90e21
4 changed files with 15 additions and 8 deletions

View file

@ -27,6 +27,10 @@ corrections:
Tests: SYSTEM_RC EXEC_RC Tests: SYSTEM_RC EXEC_RC
Issue reported by Felix Winkelmann. Issue reported by Felix Winkelmann.
AddressSanitizer reported a few buffer overflows (false positives).
Nevertheless fixed Socat source.
Issue reported by Hanno Böck.
porting: porting:
Type conflict between int and sig_atomic_t between declaration and Type conflict between int and sig_atomic_t between declaration and
definition of diag_immediate_type and diag_immediate_exit broke definition of diag_immediate_type and diag_immediate_exit broke

View file

@ -2700,11 +2700,14 @@ $CMD1 </dev/null >$tf 2>"${te}1" &
bg=$! # background process id bg=$! # background process id
waitfile "$ts" waitfile "$ts"
echo "$da" |$CMD2 >>"$tf" 2>>"${te}2" echo "$da" |$CMD2 >>"$tf" 2>>"${te}2"
if [ $? -ne 0 ]; then rc2=$?
if [ "$rc2" -ne 0 ]; then
$PRINTF "$FAILED: $TRACE $SOCAT:\n" $PRINTF "$FAILED: $TRACE $SOCAT:\n"
echo "$CMD1 &" echo "$CMD1 &"
echo "$CMD2" echo "$CMD2"
cat "$te" echo "rc=$rc2"
cat "${te}1"
cat "${te}2"
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then elif ! echo "$da" |diff - "$tf" >"$tdiff"; then

View file

@ -90,9 +90,9 @@ static int xioopen_gopen(int argc, const char *argv[], struct opt *opts, int xio
return result; return result;
#ifdef I_PUSH #ifdef I_PUSH
if (S_ISCHR(st_mode)) { if (S_ISCHR(st_mode)) {
Ioctl(result, I_PUSH, "ptem"); Ioctl(result, I_PUSH, "ptem\0\0\0"); /* pad string length ... */
Ioctl(result, I_PUSH, "ldterm"); Ioctl(result, I_PUSH, "ldterm\0"); /* ... to requirements of ... */
Ioctl(result, I_PUSH, "ttcompat"); Ioctl(result, I_PUSH, "ttcompat"); /* ... AdressSanitizer */
} }
#endif #endif
fd->stream.fd = result; fd->stream.fd = result;

View file

@ -252,9 +252,9 @@ int _xioopen_foxec(int xioflags, /* XIO_RDONLY etc. */
/* AIX: I_PUSH def'd; pty: ioctl(, I_FIND, ...) -> 1 */ /* AIX: I_PUSH def'd; pty: ioctl(, I_FIND, ...) -> 1 */
/* SunOS: I_PUSH def'd; pty: ioctl(, I_FIND, ...) -> 0 */ /* SunOS: I_PUSH def'd; pty: ioctl(, I_FIND, ...) -> 0 */
/* HP-UX: I_PUSH def'd; pty: ioctl(, I_FIND, ...) -> 0 */ /* HP-UX: I_PUSH def'd; pty: ioctl(, I_FIND, ...) -> 0 */
if (Ioctl(ttyfd, I_FIND, "ldterm") == 0) { if (Ioctl(ttyfd, I_FIND, "ldterm\0") == 0) {
Ioctl(ttyfd, I_PUSH, "ptem"); /* 0 */ Ioctl(ttyfd, I_PUSH, "ptem\0\0\0"); /* 0 */ /* padding for AdressSanitizer */
Ioctl(ttyfd, I_PUSH, "ldterm"); /* 0 */ Ioctl(ttyfd, I_PUSH, "ldterm\0"); /* 0 */
Ioctl(ttyfd, I_PUSH, "ttcompat"); /* HP-UX: -1 */ Ioctl(ttyfd, I_PUSH, "ttcompat"); /* HP-UX: -1 */
} }
#endif #endif