From 2a9d1fe9f99cc2329a762f6e30a8ee0dc8e84014 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 9 Jan 2008 22:19:42 +0000 Subject: Fix a read-past-end bug in xine-lib's internal strtok_r replacement. --- lib/strtok_r.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/strtok_r.c b/lib/strtok_r.c index cead029a2..8a5284a42 100644 --- a/lib/strtok_r.c +++ b/lib/strtok_r.c @@ -19,7 +19,7 @@ char *xine_private_strtok_r(char *s, const char *delim, char **ptrptr) { else s = *ptrptr; /* end of searching */ - if (!s || s == '\0') return NULL; + if (!s || !*s) return NULL; /* cut the initial garbage */ cutlen = strspn(s, delim); @@ -32,12 +32,12 @@ char *xine_private_strtok_r(char *s, const char *delim, char **ptrptr) { } next = s + toklen; + /* prepare next call */ + *ptrptr = *next ? next + 1 : NULL; + /* cut current token */ *next = '\0'; - /* prepare next call */ - *ptrptr = next + 1; - /* return the token */ return s; } -- cgit v1.2.3 From cbbfd6efbf8b632fc039eb1fce729258b5ac3bdb Mon Sep 17 00:00:00 2001 From: Carlo Bramini Date: Mon, 11 Feb 2008 16:38:48 +0000 Subject: Fix to timegm.c timegm.c uses tzset(), but if host does not provide it, compilation or linking will fail. I fixed it by checking the status of HAVE_TZSET. If the function is not detected at configure time, it won't be used, like it has been done in other parts of xine-lib. --- lib/timegm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/timegm.c b/lib/timegm.c index 588131afb..e86e66370 100644 --- a/lib/timegm.c +++ b/lib/timegm.c @@ -5,15 +5,19 @@ time_t xine_private_timegm(struct tm *tm) { time_t ret; +#if defined(HAVE_TZSET) char *tz; tz = getenv("TZ"); setenv("TZ", "", 1); tzset(); +#endif ret = mktime(tm); +#if defined(HAVE_TZSET) if (tz) setenv("TZ", tz, 1); else unsetenv("TZ"); tzset(); +#endif return ret; } -- cgit v1.2.3