Ticket #4844: libs_libmythdvdnav_dvdnav_internal.h-make-sure-printerr-doesnt-dreference-null-pointers.patch

File libs_libmythdvdnav_dvdnav_internal.h-make-sure-printerr-doesnt-dreference-null-pointers.patch, 749 bytes (added by Erik Hovland <erik@…>, 16 years ago)

check this before dereferencing it

  • libs/libmythdvdnav/dvdnav_internal.h

    The function printerr can dereference a null pointer 'this'. It shouldn't.
    
    From: Erik Hovland <erik@hovland.org>
    
    
    ---
    
     libs/libmythdvdnav/dvdnav_internal.h |    2 +-
     1 files changed, 1 insertions(+), 1 deletions(-)
    
    diff --git a/libs/libmythdvdnav/dvdnav_internal.h b/libs/libmythdvdnav/dvdnav_internal.h
    index fc086a8..7b008e2 100644
    a b struct dvdnav_s { 
    194194#define printerrf(...) snprintf(this->err_str, MAX_ERR_LEN, __VA_ARGS__);
    195195#endif /* WIN32 */
    196196#endif
    197 #define printerr(str) strncpy(this->err_str, str, MAX_ERR_LEN);
     197#define printerr(str) if (this) strncpy(this->err_str, str, MAX_ERR_LEN);
    198198
    199199#endif /* DVDNAV_INTERNAL_H_INCLUDED */