From: "Dmitry V. Levin" <ldv@altlinux.org> To: ALT Devel discussion list <devel@altlinux.ru> Subject: Re: [devel] NMU: fortune-mod, U: fortunes-ALT Date: Mon, 2 Jun 2003 12:18:09 +0400 Message-ID: <20030602081809.GC8759@basalt.office.altlinux.org> (raw) In-Reply-To: <20030602031557.633fe4e1.bga@altlinux.ru> [-- Attachment #1: Type: text/plain, Size: 758 bytes --] On Mon, Jun 02, 2003 at 03:15:57AM +0400, Grigory Batalov wrote: > char temp_filename[256]; 256 - маловато будет > ... > if (!(ptr = getenv ("TMPDIR"))) > fatal_error (2, "TMPDIR"); Не будет работать, если TMPDIR не определён. > snprintf (temp_filename, 256, "%s/linpopup.XXXXXX", ptr); Нет проверки, поместилось ли имя файла в буфер. > file_handle_temp = mkstemp (temp_filename); Нет проверки на код возврата. > write (file_handle_temp, message_text, strlen (message_text)); Запись в непроверенный дескриптор. > close (file_handle_temp); > ... > unlink (temp_filename); Race condition. unlink должен быть сразу после mkstemp, и обязательно до close. Похоже на набор граблей, а не на работоспособный код, верно? -- ldv [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2003-06-02 8:18 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-06-01 22:19 Alexey I. Froloff 2003-06-01 23:15 ` Grigory Batalov 2003-06-02 7:46 ` Stanislav Ievlev 2003-06-02 18:38 ` Grigory Batalov 2003-06-03 6:20 ` [devel] " Anton V. Boyarshinov 2003-06-02 8:18 ` Dmitry V. Levin [this message] 2003-06-02 9:02 ` [devel] " Igor Homyakov 2003-06-02 9:40 ` [devel] " Alexey Tourbin 2003-06-02 10:49 ` [devel] Re: printf(3) Igor Homyakov 2003-06-03 8:07 ` Dmitry V. Levin 2003-06-02 10:48 ` [devel] mkstemp in linpopup (was: NMU: fortune-mod, U: fortunes-ALT) Grigory Batalov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030602081809.GC8759@basalt.office.altlinux.org \ --to=ldv@altlinux.org \ --cc=devel@altlinux.ru \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Team development discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \ devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru public-inbox-index devel Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git