public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Ken Brown <kbrown@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: path_conv::eq_worker: add NULL pointer checks Date: Mon, 16 Nov 2020 13:40:20 +0000 (GMT) [thread overview] Message-ID: <20201116134020.AC9453857C61@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=22d1ebacfc5a1d3596d5dc25c2464fa51ed58944 commit 22d1ebacfc5a1d3596d5dc25c2464fa51ed58944 Author: Ken Brown <kbrown@cornell.edu> Date: Sat Nov 14 09:02:43 2020 -0500 Cygwin: path_conv::eq_worker: add NULL pointer checks Don't call cstrdup on NULL pointers. This fixes a crash that was observed when cloning an fhandler whose path_conv member had freed its strings. Diff: --- winsup/cygwin/path.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index b94f13df8..0b3e72fc1 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -320,9 +320,11 @@ class path_conv contrast to statically allocated strings. Calling device::dup() will duplicate the string if the source was allocated. */ dev.dup (); - path = cstrdup (in_path); + if (in_path) + path = cstrdup (in_path); conv_handle.dup (pc.conv_handle); - posix_path = cstrdup(pc.posix_path); + if (pc.posix_path) + posix_path = cstrdup(pc.posix_path); if (pc.wide_path) { wide_path = cwcsdup (uni_path.Buffer);
reply other threads:[~2020-11-16 13:40 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201116134020.AC9453857C61@sourceware.org \ --to=kbrown@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).