From c6f8f0e73654f90e5050da668d40d9af2d0b8759 Mon Sep 17 00:00:00 2001 From: Tom MTT Date: Tue, 29 Nov 2022 14:16:11 +0100 Subject: [PATCH 1/7] fix(bin.c): error check and paste size --- bin.c | 2 +- config.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin.c b/bin.c index d744b8b..a927f78 100644 --- a/bin.c +++ b/bin.c @@ -91,7 +91,7 @@ int write_paste(char *paste, unsigned long paste_size, char *id) return -1; /* write the content to file */ - if (fwrite(paste, paste_size, sizeof(char), file) == -1) { + if (fwrite(paste, sizeof(char), paste_size, file) != paste_size) { fclose(file); return -1; } diff --git a/config.mk b/config.mk index 9bf583c..87cb54d 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ # feuille version -VERSION = 1.19.0 +VERSION = 1.19.1 # paths (customize them to fit your system) PREFIX = /usr/local From 38b6f2ddc53883c3860232b82a957568c43bc75a Mon Sep 17 00:00:00 2001 From: Tom MTT Date: Tue, 29 Nov 2022 14:18:38 +0100 Subject: [PATCH 2/7] style(feuille.c): newline --- feuille.c | 1 + 1 file changed, 1 insertion(+) diff --git a/feuille.c b/feuille.c index 7e2a587..6141d50 100644 --- a/feuille.c +++ b/feuille.c @@ -339,6 +339,7 @@ int main(int argc, char *argv[]) uid = user->pw_uid; gid = user->pw_gid; + } else { puts(""); syslog(LOG_WARNING, "running as non-root user."); From 4b3b46e7ab3144bfa2f3dc443cd7cc028633eb2c Mon Sep 17 00:00:00 2001 From: Tom MTT Date: Tue, 29 Nov 2022 14:28:16 +0100 Subject: [PATCH 3/7] fix(feuille.c): initialize uid and gid to remove useless warnings --- config.mk | 2 +- feuille.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config.mk b/config.mk index 87cb54d..598720b 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ # feuille version -VERSION = 1.19.1 +VERSION = 1.19.2 # paths (customize them to fit your system) PREFIX = /usr/local diff --git a/feuille.c b/feuille.c index 6141d50..62143cc 100644 --- a/feuille.c +++ b/feuille.c @@ -326,7 +326,7 @@ int main(int argc, char *argv[]) chdir(path); /* user checks */ - int uid, gid; + int uid = 0, gid = 0; if (getuid() == 0) { if (strlen(settings.user) == 0) settings.user = "nobody"; From 9f9a25237a86d90d7593fd0b53390c3a9953515f Mon Sep 17 00:00:00 2001 From: Tom MTT Date: Tue, 29 Nov 2022 14:28:35 +0100 Subject: [PATCH 4/7] chore: update manpage --- feuille.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feuille.1 b/feuille.1 index 6127a62..afeb4b1 100644 --- a/feuille.1 +++ b/feuille.1 @@ -14,7 +14,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "feuille" "1" "November 2022" "feuille 1.19.0" "" +.TH "feuille" "1" "November 2022" "feuille 1.19.2" "" .hy .SH NAME .PP From de702c9b58e6d74b2b7291b927147ef583cd8a36 Mon Sep 17 00:00:00 2001 From: Tom MTT Date: Tue, 29 Nov 2022 14:31:29 +0100 Subject: [PATCH 5/7] fix(feuille.c): use {u,g}id_t instead of int for uid and gid --- config.mk | 6 +++--- feuille.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config.mk b/config.mk index 598720b..f4429ff 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ # feuille version -VERSION = 1.19.2 +VERSION = 1.19.3 # paths (customize them to fit your system) PREFIX = /usr/local @@ -18,8 +18,8 @@ LIBS = -L/usr/lib -lc CC = cc # debug build -CFLAGS = -g -std=c99 -Wall -Wextra -Wpedantic -Wno-sign-compare -DVERSION=\"$(VERSION)\" -DDEBUG $(INCS) -LDFLAGS = -g $(LIBS) +CFLAGS = -g -std=c99 -Wall -Wextra -Wpedantic -Wno-sign-compare -ggdb -Wall -Wextra -pedantic -fsanitize=address -fno-omit-frame-pointer -DVERSION=\"$(VERSION)\" -DDEBUG $(INCS) +LDFLAGS = -g $(LIBS) -g -std=c99 -Wall -Wextra -Wpedantic -Wno-sign-compare -ggdb -Wall -Wextra -pedantic -fsanitize=address -fno-omit-frame-pointer -DVERSION=\"$(VERSION)\" -DDEBUG $(INCS) # release build CFLAGS$(DEBUG) = -std=c99 -Wall -Wextra -Wno-sign-compare -DVERSION=\"$(VERSION)\" -O3 $(INCS) diff --git a/feuille.c b/feuille.c index 62143cc..55a1d7f 100644 --- a/feuille.c +++ b/feuille.c @@ -326,7 +326,8 @@ int main(int argc, char *argv[]) chdir(path); /* user checks */ - int uid = 0, gid = 0; + uid_t uid = 0; + gid_t gid = 0; if (getuid() == 0) { if (strlen(settings.user) == 0) settings.user = "nobody"; From 65ecf9d81a05de601864578778918ebe34e6f043 Mon Sep 17 00:00:00 2001 From: Tom MTT Date: Tue, 29 Nov 2022 14:32:29 +0100 Subject: [PATCH 6/7] fix: remove dynamic analysis debug flags --- config.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.mk b/config.mk index f4429ff..b50fe62 100644 --- a/config.mk +++ b/config.mk @@ -18,8 +18,8 @@ LIBS = -L/usr/lib -lc CC = cc # debug build -CFLAGS = -g -std=c99 -Wall -Wextra -Wpedantic -Wno-sign-compare -ggdb -Wall -Wextra -pedantic -fsanitize=address -fno-omit-frame-pointer -DVERSION=\"$(VERSION)\" -DDEBUG $(INCS) -LDFLAGS = -g $(LIBS) -g -std=c99 -Wall -Wextra -Wpedantic -Wno-sign-compare -ggdb -Wall -Wextra -pedantic -fsanitize=address -fno-omit-frame-pointer -DVERSION=\"$(VERSION)\" -DDEBUG $(INCS) +CFLAGS = -g -std=c99 -Wall -Wextra -Wpedantic -Wno-sign-compare -DVERSION=\"$(VERSION)\" -DDEBUG $(INCS) +LDFLAGS = -g $(LIBS) # release build CFLAGS$(DEBUG) = -std=c99 -Wall -Wextra -Wno-sign-compare -DVERSION=\"$(VERSION)\" -O3 $(INCS) From 8764f006557e3b380ce2e75df3bc7b8b4a48f4fd Mon Sep 17 00:00:00 2001 From: Tom MTT Date: Tue, 29 Nov 2022 14:47:35 +0100 Subject: [PATCH 7/7] chore: update manpage --- feuille.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feuille.1 b/feuille.1 index afeb4b1..22d65c8 100644 --- a/feuille.1 +++ b/feuille.1 @@ -14,7 +14,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "feuille" "1" "November 2022" "feuille 1.19.2" "" +.TH "feuille" "1" "November 2022" "feuille 1.19.3" "" .hy .SH NAME .PP