1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
Description: Debian diff as of version 1.4.3-L3.0.6+main-6
Last-Update: 2021-12-29
--- a/Maelstrom-netd.c
+++ b/Maelstrom-netd.c
@@ -50,7 +50,7 @@ void DisconnectPlayer(int which)
(void) free(players[which].packet);
close(players[which].sockfd);
players[which].state = UNCONNECTED;
-printf("Player on slot %d has been disconnected.\n", which);
+ printf("Player on slot %d has been disconnected.\n", which);
}
void SendError(int which, char *message)
@@ -65,8 +65,8 @@ void SendError(int which, char *message)
}
mesgbuf[0] = mesglen;
mesgbuf[1] = NET_ABORT;
- strcpy((char *)&mesgbuf[2], message);
-printf("Sending error '%s' to player in slot %d\n", message, which);
+ strncpy((char *)&mesgbuf[2], message, sizeof(mesgbuf)-2);
+ printf("Sending error '%s' to player in slot %d\n", message, which);
(void) write(players[which].sockfd, mesgbuf, mesglen);
DisconnectPlayer(which);
@@ -126,7 +126,7 @@ void CheckNewGame(void)
if ( players[i].state != ACTIVE )
continue;
if ( players[i].numplayers != numplayers ) {
- sprintf(buffer,
+ snprintf(buffer, sizeof(buffer),
"There are %d, not %d players in this game",
numplayers, players[i].numplayers);
SendError(i, (char *)buffer);
@@ -156,11 +156,11 @@ printf("Let's party!!\n");
for ( i=0; i<numplayers; ++i ) {
connection *player = &players[positions[i]];
- strcpy(ptr, (char *)inet_ntoa(player->raddr.sin_addr));
+ strncpy(ptr, (char *)inet_ntoa(player->raddr.sin_addr), (BUFSIZ-len));
printf("Setting up player %d at host %s and port ", i+1, ptr);
len += strlen(ptr)+1;
ptr += strlen(ptr)+1;
- sprintf(ptr, "%d", ntohs(player->raddr.sin_port));
+ snprintf(ptr, (BUFSIZ-len), "%d", ntohs(player->raddr.sin_port));
printf("%s\n", ptr);
len += strlen(ptr)+1;
ptr += strlen(ptr)+1;
@@ -345,7 +345,7 @@ printf("Connection received on port %d\n
if ( i != MAX_CONNECTIONS ) {
char message[BUFSIZ];
- sprintf(message, "Player %d is already on!",
+ snprintf(message, sizeof(message), "Player %d is already on!",
player+1);
SendError(slot, message);
continue;
--- a/README.options.txt
+++ b/README.options.txt
@@ -55,7 +55,8 @@ Command Line Options:
-fullscreen This option puts a big black border around the
Maelstrom screen, and centers Maelstrom within it.
This help create a "full screen" effect on large
- displays.
+ displays. During the game the fullscreen mode can
+ be toggled using Alt+Return.
-version This option prints the version of the Maelstrom binary.
--- a/buttonlist.h
+++ b/buttonlist.h
@@ -16,7 +16,7 @@ public:
void Add_Button(Uint16 x, Uint16 y, Uint16 width, Uint16 height,
void (*callback)(void)) {
- struct button *belem;
+ button *belem;
for ( belem=&button_list; belem->next; belem=belem->next );
belem->next = new button;
@@ -30,7 +30,7 @@ public:
}
void Activate_Button(Uint16 x, Uint16 y) {
- struct button *belem;
+ button *belem;
for ( belem=button_list.next; belem; belem=belem->next ) {
if ( (x >= belem->x1) && (x <= belem->x2) &&
@@ -42,7 +42,7 @@ public:
}
void Delete_Buttons(void) {
- struct button *belem, *btemp;
+ button *belem, *btemp;
for ( belem=button_list.next; belem; ) {
btemp = belem;
--- a/init.cpp
+++ b/init.cpp
@@ -735,6 +735,10 @@ int DoInitializations(Uint32 video_flags
}
atexit(CleanUp);
signal(SIGSEGV, exit);
+ signal(SIGTERM, exit);
+ signal(SIGKILL, exit);
+ signal(SIGHUP, exit);
+ signal(SIGINT, exit);
// -- Initialize some variables
gLastHigh = -1;
--- a/maclib/macres.cpp
+++ b/maclib/macres.cpp
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
ids[j], res->ResourceName(types[i], ids[j]));
if ( argv[2] ) {
char path[23];
- sprintf(path,"%s/%s:%hu", argv[2],
+ snprintf(path,sizeof(path),"%s/%s:%hu", argv[2],
types[i], ids[j]);
FILE *output;
Mac_ResData *D;
--- a/maclib/snd2wav.cpp
+++ b/maclib/snd2wav.cpp
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
continue;
}
wave.Load(snd, rate);
- sprintf(wavname, "snd_%d.wav", ids[i]);
+ snprintf(wavname, sizeof(wavname), "snd_%d.wav", ids[i]);
wave.Save(wavname);
}
delete macx;
|