OSDN Git Service

strncpy()、ネ、テ、ニ、、、ニ。「スェテシハクサ妤ヘホク、キ、ニ、、、ハ、、、ネ、ウ、惕、タオ。」
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Tue, 29 Jan 2002 13:29:32 +0000 (13:29 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Tue, 29 Jan 2002 13:29:32 +0000 (13:29 +0000)
src/chuukei.c
src/util.c

index dcbaf71..c02c8d9 100644 (file)
@@ -265,6 +265,7 @@ static int read_chuukei_prf(cptr prf_name)
                if (!strncmp(buf, "server:", 7))
                {
                        strncpy(server_name, buf + 7, MAX_HOSTNAME);
+                       server_name[MAX_HOSTNAME] = '\0';
                }
 
                /* ¥Ý¡¼¥ÈÈÖ¹æ */
index 1625c19..14c5496 100644 (file)
@@ -397,7 +397,7 @@ FILE *my_fopen_temp(char *buf, int max)
        int fd;
 
        /* Prepare the buffer for mkstemp */
-       strncpy(buf, "/tmp/anXXXXXX", max);
+       (void)strnfmt(buf, max, "%s", "/tmp/anXXXXXX");
 
        /* Secure creation of a temporary file */
        fd = mkstemp(buf);