diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2006-09-26 20:17:43 +0000 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2006-09-26 20:17:43 +0000 |
commit | 02fa6224a5170a5912276c9b2150c4b7574745f9 (patch) | |
tree | 12f054bc1b55d5a173b667d1663a11dbe7b0d0d6 /src | |
parent | 59ba0962e0be99fb4d49de482d9456ee446a4d51 (diff) | |
download | xine-lib-02fa6224a5170a5912276c9b2150c4b7574745f9.tar.gz xine-lib-02fa6224a5170a5912276c9b2150c4b7574745f9.tar.bz2 |
printerr() macros are often used when the pointer "this" is NULL. In those cases the result is an immediate segfault, as it's dereferenced.
To avoid this, use fprintf instead of writing in err_str.
CVS patchset: 8299
CVS date: 2006/09/26 20:17:43
Diffstat (limited to 'src')
-rw-r--r-- | src/input/libdvdnav/dvdnav_internal.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/input/libdvdnav/dvdnav_internal.h b/src/input/libdvdnav/dvdnav_internal.h index d6e8bef5b..737ef6387 100644 --- a/src/input/libdvdnav/dvdnav_internal.h +++ b/src/input/libdvdnav/dvdnav_internal.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dvdnav_internal.h,v 1.16 2006/09/17 13:01:08 valtri Exp $ + * $Id: dvdnav_internal.h,v 1.17 2006/09/26 20:17:43 dgp85 Exp $ * */ @@ -202,6 +202,10 @@ struct dvdnav_s { /** USEFUL MACROS **/ +/* printerr*() are often called when this is NULL. Avoid segfaults by replacing these with + * more common prints + */ +#if 0 #ifdef __GNUC__ #define printerrf(format, args...) snprintf(this->err_str, MAX_ERR_LEN, format, ## args); #else @@ -212,5 +216,17 @@ struct dvdnav_s { #endif /* WIN32 */ #endif #define printerr(str) strncpy(this->err_str, str, MAX_ERR_LEN); +#endif + +#ifdef __GNUC__ +#define printerrf(format, args...) fprintf(stderr, format, ## args); +#else +#ifdef _MSC_VER +#define printerrf(str) fprintf(stderr, str); +#else +#define printerrf(...) fprintf(stderr, __VA_ARGS__); +#endif /* WIN32 */ +#endif +#define printerr(str) fprintf(stderr, "%s", str); #endif /* DVDNAV_INTERNAL_H_INCLUDED */ |