Description: Added hardening to the build process.
Author: Hugo Torres de Lima <hugotorres@protonmail.com>
Last-Update: 2021-12-20
Index: convlit-1.8/clit18/Makefile
===================================================================
--- convlit-1.8.orig/clit18/Makefile
+++ convlit-1.8/clit18/Makefile
@@ -1,9 +1,12 @@
 all: clit
 
-CFLAGS+=-funsigned-char -Wall -I ../lib -I ../lib/des -I .
+CFLAGS += -fPIE -fstack-protector-strong -Wformat -Werror=format-security -funsigned-char -Wall -I ../lib -I ../lib/des -I .
+CPPFLAGS += -D_FORTIFY_SOURCE=2
+LDFLAGS += -fPIE -pie -Wl,-z,relro -Wl,-z,now
+
 clean:
 	rm -f *.o clit
 
 clit: clit.o hexdump.o drm5.o explode.o transmute.o display.o utils.o manifest.o ../lib/openclit.a 
-	gcc -o clit $^  -ltommath
+	gcc $(LDFLAGS) -o clit $^  -ltommath
 
Index: convlit-1.8/clit18/clit.c
===================================================================
--- convlit-1.8.orig/clit18/clit.c
+++ convlit-1.8/clit18/clit.c
@@ -125,9 +125,9 @@ int main(int argc, char ** argv)
             dir_program[i+1] = '\0'; break;
         }
     }
-    printf(sTitle);
+    fputs(sTitle, stdout);
     if (argc < 3) { 
-        printf(sUsage);
+        fputs(sUsage, stdout);
         return -1;
     }
     base = 1;
Index: convlit-1.8/lib/Makefile
===================================================================
--- convlit-1.8.orig/lib/Makefile
+++ convlit-1.8/lib/Makefile
@@ -1,6 +1,8 @@
 all: openclit.a
 
-CFLAGS+=-Wall -Ides -Isha -Inewlzx -I.
+CFLAGS += -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wall -Ides -Isha -Inewlzx -I.
+CPPFLAGS += -D_FORTIFY_SOURCE=2
+
 clean:
 	rm -f *.o openclit.a des/*.o newlzx/*.o sha/*.o
 
