Bug#732207: Fix for segfault on amd64

Chris Lawrence <[email protected]> Sun, 29 Dec 2013 23:03:23 -0500
Newsgroups gmane.comp.video.tvtime.devel
Message-ID <20131230040323.GA29224__22387.1897826486$1388376387$gmane$org@lordsutch.dyndns.org>
--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

The attached version of debian/patches/home.diff fixes the segfaults
on amd64. As Aurelien suggests, someone probably should tackle the
real underlying issues with $HOME, but this at least fixes the
immediate issue.


Chris
-- 
Chris Lawrence <[email protected]> - http://blog.lordsutch.com/

--oyUTqETQ0mS9luUI
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="home.diff"

Index: tvtime-1.0.2/src/tvtime-command.c
===================================================================
--- tvtime-1.0.2.orig/src/tvtime-command.c	2013-12-29 22:56:03.174954919 -0500
+++ tvtime-1.0.2/src/tvtime-command.c	2013-12-29 22:56:03.141624220 -0500
@@ -39,6 +39,9 @@
 
 int main( int argc, char **argv )
 {
+    if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
+    if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
+
     int nc = tvtime_num_commands();
     config_t *cfg;
     FILE *fifo;
Index: tvtime-1.0.2/src/tvtime-configure.c
===================================================================
--- tvtime-1.0.2.orig/src/tvtime-configure.c	2013-12-29 22:56:03.174954919 -0500
+++ tvtime-1.0.2/src/tvtime-configure.c	2013-12-29 22:56:46.594858631 -0500
@@ -16,6 +16,8 @@
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <string.h>
+#include <stdlib.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -35,6 +37,9 @@
 
 int main( int argc, char **argv )
 {
+    if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
+    if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
+
     config_t *cfg;
 
     /*
Index: tvtime-1.0.2/src/tvtime-scanner.c
===================================================================
--- tvtime-1.0.2.orig/src/tvtime-scanner.c	2013-12-29 22:56:03.174954919 -0500
+++ tvtime-1.0.2/src/tvtime-scanner.c	2013-12-29 22:57:06.263305223 -0500
@@ -24,6 +24,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string.h>
+#include <stdlib.h>
 #include <fcntl.h>
 #include <unistd.h>
 #ifdef HAVE_CONFIG_H
@@ -42,6 +43,9 @@
 
 int main( int argc, char **argv )
 {
+    if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
+    if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
+
     config_t *cfg;
     station_mgr_t *stationmgr = 0;
     videoinput_t *vidin;
Index: tvtime-1.0.2/src/tvtime.c
===================================================================
--- tvtime-1.0.2.orig/src/tvtime.c	2013-12-29 22:56:03.174954919 -0500
+++ tvtime-1.0.2/src/tvtime.c	2013-12-29 22:56:03.144957290 -0500
@@ -2643,6 +2643,9 @@
 
 int main( int argc, char **argv )
 {
+    if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
+    if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
+
     rtctimer_t *rtctimer = 0;
     int read_stdin = 1;
     int result = 0;

--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tvtime-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tvtime-devel

--oyUTqETQ0mS9luUI--