diff -u -r angband-291/src/main.c angband/src/main.c
--- angband-291/src/main.c	Tue Jul 25 20:57:50 2000
+++ angband/src/main.c	Fri Sep 22 20:16:02 2000
@@ -77,6 +77,10 @@
  *
  * Note that the "path" must be "Angband:" for the Amiga, and it
  * is ignored for "VM/ESA", so I just combined the two.
+ *
+ * Make sure that the path doesn't overflow the buffer.  We have
+ * to leave enough space for the path separator, directory, and
+ * filenames.
  */
 static void init_stuff(void)
 {
@@ -95,7 +99,10 @@
 	tail = getenv("ANGBAND_PATH");
 
 	/* Use the angband_path, or a default */
-	strcpy(path, tail ? tail : DEFAULT_PATH);
+	strncpy(path, tail ? tail : DEFAULT_PATH, 511);
+
+	/* Make sure it's terminated */
+	path[511] = '\0';
 
 	/* Hack -- Add a path separator (only if needed) */
 	if (!suffix(path, PATH_SEP)) strcat(path, PATH_SEP);
@@ -406,7 +413,13 @@
 			case 'U':
 			{
 				if (!argv[i][2]) goto usage;
-				strcpy(op_ptr->full_name, &argv[i][2]);
+
+				/* Get the savefile name */
+				strncpy(op_ptr->full_name, &argv[i][2], 32);
+
+				/* Make sure it's terminated */
+				op_ptr->full_name[31] = '\0';
+
 				break;
 			}
 
diff -u -r angband-291/src/z-form.c angband/src/z-form.c
--- angband-291/src/z-form.c	Tue Jul 25 20:57:50 2000
+++ angband/src/z-form.c	Sun Sep 17 20:10:20 2000
@@ -562,6 +562,7 @@
 			case 's':
 			{
 				cptr arg;
+				char arg2[1024];
 
 				/* Get the next argument */
 				arg = va_arg(vp, cptr);
@@ -569,8 +570,12 @@
 				/* Hack -- convert NULL to EMPTY */
 				if (!arg) arg = "";
 
+				/* Prevent buffer overflows */
+				strncpy(arg2, arg, 1024);
+				arg2[1023] = '\0';
+
 				/* Format the argument */
-				sprintf(tmp, aux, arg);
+				sprintf(tmp, aux, arg2);
 
 				/* Done */
 				break;


