public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: games-server/crossfire-server/files/, games-server/crossfire-server/
@ 2015-12-15 20:47 Alfredo Tupone
  0 siblings, 0 replies; 2+ messages in thread
From: Alfredo Tupone @ 2015-12-15 20:47 UTC (permalink / raw
  To: gentoo-commits

commit:     0ef2a66801ebe2b01265d26c5d9d497bf6277dd5
Author:     Tupone Alfredo <tupone <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 15 20:46:09 2015 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Tue Dec 15 20:46:43 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ef2a668

games-server/crossfire-server: Fix format security. Bug #544352

Package-Manager: portage-2.2.24

 .../crossfire-server/crossfire-server-1.71.0.ebuild  |  1 +
 .../files/crossfire-server-1.71.0-format.patch       | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/games-server/crossfire-server/crossfire-server-1.71.0.ebuild b/games-server/crossfire-server/crossfire-server-1.71.0.ebuild
index e0c1918..06055ec 100644
--- a/games-server/crossfire-server/crossfire-server-1.71.0.ebuild
+++ b/games-server/crossfire-server/crossfire-server-1.71.0.ebuild
@@ -28,6 +28,7 @@ RDEPEND=${DEPEND}
 src_prepare() {
 	rm -f "${WORKDIR}"/maps/Info/combine.pl # bug #236205
 	ln -s "${WORKDIR}/arch" "${S}/lib" || die
+	epatch "${FILESDIR}"/${P}-format.patch
 }
 
 src_configure() {

diff --git a/games-server/crossfire-server/files/crossfire-server-1.71.0-format.patch b/games-server/crossfire-server/files/crossfire-server-1.71.0-format.patch
new file mode 100644
index 0000000..174b785
--- /dev/null
+++ b/games-server/crossfire-server/files/crossfire-server-1.71.0-format.patch
@@ -0,0 +1,20 @@
+--- server/c_chat.c.old	2015-12-15 21:35:30.024866220 +0100
++++ server/c_chat.c	2015-12-15 21:36:58.479266312 +0100
+@@ -483,7 +483,7 @@
+     { "You spit over your left shoulder.", "%s spits over his left shoulder." },
+     { "Strut your stuff.", "%s struts proudly." },
+     { NULL, NULL },
+-    { "%s patiently twiddles his thumbs.", "You patiently twiddle your thumbs." },
++    { "You patiently twiddle your thumbs.", "%s patiently twiddles his thumbs." },
+     { "You wave.", "%s waves happily." },
+     { "You whistle appreciatively.", "%s whistles appreciatively." },
+     { "Have you got something in your eye?", "%s winks suggestively." },
+@@ -645,7 +645,7 @@
+ 
+     if (*params == '\0') {
+         if (emotion > EMOTE_FIRST && emotion < EMOTE_LAST && single_emotes[emotion - 1][0] != NULL) {
+-            snprintf(buf, sizeof(buf), single_emotes[emotion - 1][0]);
++            snprintf(buf, sizeof(buf), "%s", single_emotes[emotion - 1][0]);
+             snprintf(buf2, sizeof(buf2), single_emotes[emotion - 1][1], op->name);
+         } else {
+             snprintf(buf, sizeof(buf), "You are a nut.");


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: games-server/crossfire-server/files/, games-server/crossfire-server/
@ 2025-02-14  5:18 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2025-02-14  5:18 UTC (permalink / raw
  To: gentoo-commits

commit:     7be46628ec604d533b1eeea5df0ae2c8cceef7d4
Author:     NHOrus <jy6x2b32pie9 <AT> yahoo <DOT> com>
AuthorDate: Tue Feb 11 12:14:15 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 14 05:13:45 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7be46628

games-server/crossfire-server: port to C23

function pointer to (void)() functions was used as a prototype for
polymorphic dispatch, with num_args parameter showing number of
arguments to pass to function. As num_args is either 0 or 1,
and non-void functions take const char* as an argument, changing
every signature to const char* and not passing argument to
0-argument functions is the only solution without major re-engineering.

Closes: https://bugs.gentoo.org/949574
Signed-off-by: NHOrus <jy6x2b32pie9 <AT> yahoo.com>
Closes: https://github.com/gentoo/gentoo/pull/40529
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ....0.ebuild => crossfire-server-1.75.0-r1.ebuild} |   4 +-
 ...-server-1.75.0-incompatible-func-pointers.patch | 175 +++++++++++++++++++++
 2 files changed, 178 insertions(+), 1 deletion(-)

diff --git a/games-server/crossfire-server/crossfire-server-1.75.0.ebuild b/games-server/crossfire-server/crossfire-server-1.75.0-r1.ebuild
similarity index 91%
rename from games-server/crossfire-server/crossfire-server-1.75.0.ebuild
rename to games-server/crossfire-server/crossfire-server-1.75.0-r1.ebuild
index 17c9af84474b..57b8bdecb757 100644
--- a/games-server/crossfire-server/crossfire-server-1.75.0.ebuild
+++ b/games-server/crossfire-server/crossfire-server-1.75.0-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -26,6 +26,8 @@ RDEPEND="
 	)
 "
 
+PATCHES=( "${FILESDIR}/${P}-incompatible-func-pointers.patch" )
+
 src_prepare() {
 	default
 

diff --git a/games-server/crossfire-server/files/crossfire-server-1.75.0-incompatible-func-pointers.patch b/games-server/crossfire-server/files/crossfire-server-1.75.0-incompatible-func-pointers.patch
new file mode 100644
index 000000000000..d4a13c415efc
--- /dev/null
+++ b/games-server/crossfire-server/files/crossfire-server-1.75.0-incompatible-func-pointers.patch
@@ -0,0 +1,175 @@
+Struct wanted (void)() function pointers. GCC-15 says no.
+We compromised on (void)(const char*) and giving no argument to functions
+that take no argument. Hopefully, when someone upstream adds
+a function with num_args > 1, it would be a problem of upstream
+https://bugs.gentoo.org/949574
+--- a/include/libproto.h
++++ b/include/libproto.h
+@@ -64,7 +64,7 @@
+ extern int64_t new_exp(const object *ob);
+ extern int has_ability(const object *ob);
+ extern void init_experience(void);
+-extern void dump_experience(void);
++extern void dump_experience(const char* v);
+ extern void free_experience(void);
+ /* friend.c */
+ extern void add_friendly_object(object *op);
+--- a/include/sproto.h
++++ b/include/sproto.h
+@@ -458,7 +458,7 @@
+ void quest_set_player_state(player *pl, sstring quest_code, int state);
+ int quest_was_completed(player *pl, sstring quest_code);
+ void command_quest(object *op, const char *params);
+-void dump_quests(void);
++void dump_quests(const char* v);
+ void free_quest(void);
+ void free_quest_definitions(void);
+ void quest_send_initial_states(player *pl);
+--- a/server/init.c
++++ b/server/init.c
+@@ -33,7 +33,7 @@
+ #include "server.h"
+ #include "sproto.h"
+ 
+-static void help(void);
++static void help(const char* v);
+ static void init_beforeplay(void);
+ static void init_startup(void);
+ static void init_signals(void);
+@@ -46,73 +46,73 @@
+  * Command line option: set logfile name.
+  * @param val new name.
+  */
+-static void set_logfile(char *val) {
++static void set_logfile(const char *val) {
+     settings.logfilename = val;
+ }
+ 
+ /** Command line option: show version. */
+-static void call_version(void) {
++static void call_version(const char* v) {
+     puts(FULL_VERSION);
+     exit(EXIT_SUCCESS);
+ }
+ 
+ /** Command line option: debug flag. */
+-static void set_debug(void) {
++static void set_debug(const char* v) {
+     settings.debug = llevDebug;
+ }
+ 
+ /** Command line option: unset debug flag. */
+-static void unset_debug(void) {
++static void unset_debug(const char* v) {
+     settings.debug = llevInfo;
+ }
+ 
+ /** Command line option: monster debug flag. */
+-static void set_mondebug(void) {
++static void set_mondebug(const char* v) {
+     settings.debug = llevMonster;
+ }
+ 
+ /** Command line option: dump monsters. */
+-static void set_dumpmon1(void) {
++static void set_dumpmon1(const char* v) {
+     settings.dumpvalues = 1;
+ }
+ 
+ /** Command line option: dump abilities. */
+-static void set_dumpmon2(void) {
++static void set_dumpmon2(const char* v) {
+     settings.dumpvalues = 2;
+ }
+ 
+ /** Command line option: dump artifacts. */
+-static void set_dumpmon3(void) {
++static void set_dumpmon3(const char* v) {
+     settings.dumpvalues = 3;
+ }
+ 
+ /** Command line option: dump spells. */
+-static void set_dumpmon4(void) {
++static void set_dumpmon4(const char* v) {
+     settings.dumpvalues = 4;
+ }
+ 
+ /** Command line option: ? */
+-static void set_dumpmon5(void) {
++static void set_dumpmon5(const char* v) {
+     settings.dumpvalues = 5;
+ }
+ 
+ /** Command line option: dump races. */
+-static void set_dumpmon6(void) {
++static void set_dumpmon6(const char* v) {
+     settings.dumpvalues = 6;
+ }
+ 
+ /** Command line option: dump alchemy. */
+-static void set_dumpmon7(void) {
++static void set_dumpmon7(const char* v) {
+     settings.dumpvalues = 7;
+ }
+ 
+ /** Command line option: dump gods. */
+-static void set_dumpmon8(void) {
++static void set_dumpmon8(const char* v) {
+     settings.dumpvalues = 8;
+ }
+ 
+ /** Command line option: dump alchemy costs. */
+-static void set_dumpmon9(void) {
++static void set_dumpmon9(const char* v) {
+     settings.dumpvalues = 9;
+ }
+ 
+@@ -246,7 +246,7 @@
+ /**
+  * Dump all animations, then exit.
+  */
+-static void server_dump_animations(void) {
++static void server_dump_animations(const char* v) {
+     dump_animations();
+     cleanup();
+ }
+@@ -267,7 +267,7 @@
+     const char *cmd_option; /**< How it is called on the command line. */
+     uint8_t num_args;         /**< Number or args it takes. */
+     uint8_t pass;             /**< What pass this should be processed on. @todo describe passes :) */
+-    void (*func)();         /**< function to call when we match this.
++    void (*func)(const char* v); /**< function to call when we match this.
+                              * if num_args is true, than that gets passed
+                              * to the function, otherwise nothing is passed
+                              */
+@@ -1056,7 +1056,7 @@
+ /**
+  * Display the command line options and exits.
+  */
+-static void help(void) {
++static void help(const char* v) {
+     printf("Usage: crossfire-server [options]\n\n");
+ 
+     printf("Options:\n");
+--- a/common/exp.c
++++ b/common/exp.c
+@@ -247,7 +247,7 @@
+  * Dump the experience table, then calls exit() - useful in terms of debugging to make sure the
+  * format of the exp_table is correct.
+  */
+-void dump_experience(void) {
++void dump_experience(const char* v) {
+     int i;
+ 
+     for (i = 1; i <= settings.max_level; i++) {
+--- a/server/quest.c
++++ b/server/quest.c
+@@ -1303,7 +1303,7 @@
+  * Dump all of the quests, then calls exit() - useful in terms of debugging to make sure that
+  * quests are set up and recognised correctly.
+  */
+-void dump_quests(void) {
++void dump_quests(const char* v) {
+     quest_load_definitions();
+     output_quests(NULL, 0);
+     exit(0);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-14  5:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15 20:47 [gentoo-commits] repo/gentoo:master commit in: games-server/crossfire-server/files/, games-server/crossfire-server/ Alfredo Tupone
  -- strict thread matches above, loose matches on Subject: below --
2025-02-14  5:18 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox