From 2eed0cdb8f860d37f4efa631719a0a9ae4f721e1 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 18 Sep 2020 15:13:19 +0200 Subject: [PATCH] include: Don't use IsBadStringPtr in debug functions for Unix libraries. Signed-off-by: Alexandre Julliard --- dlls/ntdll/unix/virtual.c | 44 --------------------------------------- include/wine/debug.h | 4 ++++ 2 files changed, 4 insertions(+), 44 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 22d328b1cec..62b2ca1346a 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3201,50 +3201,6 @@ BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) } -/************************************************************* - * IsBadStringPtrA - * - * IsBadStringPtrA replacement for ntdll, to catch exception in debug traces. - */ -BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT_PTR max ) -{ - if (!str) return TRUE; - __TRY - { - volatile const char *p = str; - while (p != str + max) if (!*p++) break; - } - __EXCEPT_SYSCALL - { - return TRUE; - } - __ENDTRY - return FALSE; -} - - -/************************************************************* - * IsBadStringPtrW - * - * IsBadStringPtrW replacement for ntdll, to catch exception in debug traces. - */ -BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT_PTR max ) -{ - if (!str) return TRUE; - __TRY - { - volatile const WCHAR *p = str; - while (p != str + max) if (!*p++) break; - } - __EXCEPT_SYSCALL - { - return TRUE; - } - __ENDTRY - return FALSE; -} - - /*********************************************************************** * virtual_uninterrupted_read_memory * diff --git a/include/wine/debug.h b/include/wine/debug.h index 912d61a90af..e064aaefb8e 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -225,7 +225,9 @@ static inline const char *wine_dbgstr_an( const char *str, int n ) if (!str) return "(null)"; if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) ); +#ifndef WINE_UNIX_LIB if (IsBadStringPtrA( str, n )) return "(invalid)"; +#endif if (n == -1) for (n = 0; str[n]; n++) ; *dst++ = '"'; while (n-- > 0 && dst <= buffer + sizeof(buffer) - 9) @@ -267,7 +269,9 @@ static inline const char *wine_dbgstr_wn( const WCHAR *str, int n ) if (!str) return "(null)"; if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) ); +#ifndef WINE_UNIX_LIB if (IsBadStringPtrW( str, n )) return "(invalid)"; +#endif if (n == -1) for (n = 0; str[n]; n++) ; *dst++ = 'L'; *dst++ = '"';