OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man3 / strcat.3
index 7877ce5..5a4d6fa 100644 (file)
 .\" This file was generated with po4a. Translate the source file.
 .\"
 .\"*******************************************************************
+.\"
+.\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
+.\"       all rights reserved.
+.\" Translated Mon Jan 20 22:47:14 JST 1997
+.\"       by YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
+.\" Updated & Modified Fri Feb 18 00:30:00 JST 2005
+.\"       by Yuichi SATO <ysato444@yahoo.co.jp>
+.\" Updated 2007-07-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.58
+.\" Updated 2012-05-29, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
+.\"
 .TH STRCAT 3 2012\-07\-19 GNU "Linux Programmer's Manual"
 .SH 名前
 strcat, strncat \- 二つの文字列を連結する
@@ -46,12 +57,11 @@ strcat, strncat \- 二つの文字列を連結する
 \fBchar *strncat(char *\fP\fIdest\fP\fB, const char *\fP\fIsrc\fP\fB, size_t \fP\fIn\fP\fB);\fP
 .fi
 .SH 説明
-The \fBstrcat\fP()  function appends the \fIsrc\fP string to the \fIdest\fP string,
-overwriting the terminating null byte (\(aq\e0\(aq) at the end of \fIdest\fP,
-and then adds a terminating null byte.  The strings may not overlap, and the
-\fIdest\fP string must have enough space for the result.  If \fIdest\fP is not
-large enough, program behavior is unpredictable; \fIbuffer overruns are a
-favorite avenue for attacking secure programs\fP.
+\fBstrcat\fP()  関数は、\fIdest\fP 文字列の後に \fIsrc\fP 文字列を付け加える。 その際に、\fIdest\fP の最後にある終端の
+NULL バイト (\(aq\e0\(aq)  は上書きされ、新たに生成された文字列の末尾に終端の NULL バイトが付与される。 二つの文字列
+\fIsrc\fP と \fIdest\fP は重なってはならない。 また、文字列 \fIdest\fP は、連結後の結果を格納するのに 十分な大きさでなければならない。
+\fIdest\fP が十分な大きさでない場合、プログラムがどのような動作をするか分からない。
+バッファオーバーランはセキュアなプログラムを攻撃する際に好んで使われる方法である。
 .PP
 \fBstrncat\fP()  も同様だが、以下の点が異なる。
 .IP * 3
@@ -90,26 +100,22 @@ strncat(char *dest, const char *src, size_t n)
 .SH 準拠
 SVr4, 4.3BSD, C89, C99.
 .SH 注意
-Some systems (the BSDs, Solaris, and others) provide the following function:
+いくつかのシステム (BSD、Solaris など) では以下の関数が提供されている。
 
     size_t strlcat(char *dest, const char *src, size_t size);
 
 .\" https://lwn.net/Articles/506530/
-This function appends the null\-terminated string \fIsrc\fP to the string
-\fIdest\fP, copying at most \fIsize\-strlen(dest)\-1\fP from \fIsrc\fP, and adds a null
-terminator to the result, \fIunless\fP \fIsize\fP is less than \fIstrlen(dest)\fP.
-This function fixes the buffer overrun problem of \fBstrcat\fP(), but the
-caller must still handle the possibility of data loss if \fIsize\fP is too
-small.  The function returns the length of the string \fBstrlcat\fP()  tried to
-create; if the return value is greater than or equal to \fIsize\fP, data loss
-occurred.  If data loss matters, the caller \fImust\fP either check the
-arguments before the call, or test the function return value.  \fBstrlcat\fP()
-is not present in glibc and is not standardized by POSIX, but is available
-on Linux via the \fIlibbsd\fP library.
+この関数は、 NULL 終端された文字列 \fIsrc\fP を文字列 \fIdest\fP に追加する。 具体例には、 \fIsize\fP が
+\fIstrlen(dest)\fP より大きい場合には最大で \fIsize\-strlen(dest)\-1\fP バイトを \fIsrc\fP からコピーし、
+結果の末尾に終端の NULL バイトを追加する。 この関数では \fBstrcat\fP() のバッファオーバーランが発生するという問題が修正されているが、
+\fIsize\fP が小さすぎた場合にはデータが失われる問題には、 依然として呼び出し側で対処する必要がある。 この関数は \fBstrlcat\fP()
+が作成しようとした文字列の長さを返す。 返り値が \fIsize\fP 以上の場合、 データロスが発生している。 データロスが問題となる場合は、
+呼び出し側で、 呼び出し前に引き数をチェックするか、 この関数の返り値を検査するかのいずれかをしなければならない。 \fBstrlcat\fP() は
+glibc には存在せず、 POSIX による標準化もされていないが、 Linux では \fIlibbsd\fP ライブラリ経由で利用できる。
 .SH 関連項目
 \fBbcopy\fP(3), \fBmemccpy\fP(3), \fBmemcpy\fP(3), \fBstrcpy\fP(3), \fBstring\fP(3),
 \fBstrncpy\fP(3), \fBwcscat\fP(3), \fBwcsncat\fP(3)
 .SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.51 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
 である。プロジェクトの説明とバグ報告に関する情報は
 http://www.kernel.org/doc/man\-pages/ に書かれている。