📄 mktemp_secure_problem
字号:
From - Wed Jun 6 23:55:45 2001Received: from localhost (rubini@localhost [127.0.0.1]) by morgana.systemy.it (8.9.3/8.9.3/Debian/GNU) with ESMTP id UAA13333 for <rubini@localhost>; Fri, 29 Dec 2000 20:30:50 +0100Received: from pop by fetchmail-4.6.4 POP3 for <rubini/localhost> (single-drop); Fri, 29 Dec 2000 20:30:50 METReceived: from systemy.systemy.it (systemy.systemy.it [194.20.140.20]) by pop.systemy.it (8.8.8/8.8.3) with ESMTP id TAA14746 for <rubini@pop.systemy.it>; Fri, 29 Dec 2000 19:33:08 +0100Received: from spock.linux.it (spock.linux.it [151.99.137.27]) by systemy.systemy.it (8.8.8/8.8.8) with ESMTP id SAA15401 for <rubini@systemy.it>; Fri, 29 Dec 2000 18:32:47 GMTReceived: from blue.int.wirex.com (unknown [216.161.55.93]) by spock.linux.it (Postfix) with ESMTP id 10E3A197B9 for <rubini@linux.it>; Fri, 29 Dec 2000 19:32:45 +0100 (CET)Received: (from greg@localhost) by blue.int.wirex.com (8.9.3/8.9.3) id KAA30085; Fri, 29 Dec 2000 10:33:32 -0800Date: Fri, 29 Dec 2000 10:33:32 -0800From: Greg KH <greg@wirex.com>To: rubini@linux.itCc: vendor-sec@lst.de, security@wirex.comSubject: temp file creation problem in gpmMessage-ID: <20001229103332.G29373@wirex.com>Mime-Version: 1.0Content-Type: text/plain; charset=us-asciiContent-Disposition: inlineUser-Agent: Mutt/1.2.5iX-Operating-System: Linux 2.2.18-immunix (i686)X-UIDL: 9c0bd8fe74181b95b30143ce1c2ddd42Status: ROHi,In building Immunix Linux 7.0, we ran across the following problem ingpm 1.19.3. I realize that gpm is unmaintained at this time, but wefigured that you might want to add this patch to your patches section onthe gpm ftp site.In the file gpn.c, the function check_uniqueness creates a temp file inan insecure way. The following patch, by Steve Beattie<steve@wirex.com> should fix this problem.thanks,greg k-hdiff -ur gpm-1.19.3-orig/gpn.c gpm-1.19.3/gpn.c--- gpm-1.19.3-orig/gpn.c Tue Jul 18 05:06:06 2000+++ gpm-1.19.3/gpn.c Fri Dec 15 13:58:37 2000@@ -223,13 +223,16 @@ static void check_uniqueness(void) {- static char tmp_pidfile [] = GPM_NODE_DIR "gpmXXXXXX";+ static char tmp_pidfile [64]; + int fd; FILE* fp = 0; - if (!mktemp(tmp_pidfile + strlen(GPM_NODE_DIR))) {- oops("mktemp()");+ strncpy (tmp_pidfile, GPM_NODE_DIR "gpmXXXXXX", 63);++ if ((fd = mkstemp(tmp_pidfile)) == -1) {+ oops("mkstemp()"); } /*if*/- if ((fp = fopen(tmp_pidfile,"w")) != NULL) {+ if ((fp = fdopen(fd,"w")) != NULL) { fprintf(fp,"%d\n",getpid()); fclose(fp); } else if (getuid()) {-- greg@(kroah|wirex).comhttp://immunix.org/~greg
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -