ref: aa3452cd2ceba89e653e48704267568ef0808097
parent: 3eb06e8c2397928e76ee4880e83a7076c21c83f8
author: mkf <mkf@pi>
date: Wed Apr 24 17:52:58 EDT 2024
srv: fix a potenial overflow error
--- a/srv.c
+++ b/srv.c
@@ -260,8 +260,10 @@
print(playersock, "GLND %d %d\n", x, y);
else
{
- strncpy(syncmsg, s, 8);
- dprint("syncmsg = %s\n", s);
+ strncpy(syncmsg, s, 7);
+ /* better be safe than sorry */
+ syncmsg[8] = '\0';
+ dprint("syncmsg = %s\n", syncmsg);
}
}
@@ -299,7 +301,9 @@
}
else
{
- strncpy(syncmsg, s, 8);
+ strncpy(syncmsg, s, 7);
+ /* better be safe than sorry */
+ syncmsg[8] = '\0';
dprint("syncmsg = %s\n", syncmsg);
}
}