File fix-insecure-code.patch of Package xgalaga

diff -Nur xgalaga-2.1.1.0/title.c new/title.c
--- xgalaga-2.1.1.0/title.c	2008-03-05 22:58:16.000000000 +0100
+++ new/title.c	2021-04-16 07:03:49.614585122 +0200
@@ -5,6 +5,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #ifdef HAVE_FCNTL_H
 # include <fcntl.h>
 #endif
@@ -150,7 +151,7 @@
             if (j>LINESIZE)
             {
               // line too long -> cut without grace
-              chLBuf[j] = 0x00;
+              chLBuf[LINESIZE] = 0x00;
               j = 0;
               strncpy (gchLBuf+(lines*(LINESIZE+1)), chLBuf, LINESIZE);
               lines++;
@@ -169,7 +170,8 @@
     close(hsf);
     free (chFBuf);
     giCreditLines = lines-1;
-  }
+    return 0;
+}
 
 
 void undo_credits()
openSUSE Build Service is sponsored by