public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Samuel Thibault <sthibaul@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] hurd: Fix FS_RETRY_MAGICAL "machtype" handling Date: Sat, 29 Apr 2023 15:01:16 +0000 (GMT) [thread overview] Message-ID: <20230429150116.990BE3858C50@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f56ad6174c62aa38f7edf68167d620482b776dc9 commit f56ad6174c62aa38f7edf68167d620482b776dc9 Author: Sergey Bugaev <bugaevc@gmail.com> Date: Sat Apr 29 16:13:54 2023 +0300 hurd: Fix FS_RETRY_MAGICAL "machtype" handling We need to set file_name, not update retryname. This is what the other branches do. Before this change, any attempt to access such a file would segfault due to file_name being unset: $ settrans -ac /tmp/my-machtype /hurd/magic machtype $ cat /tmp/my-machtype Segmentation fault Checked on i686-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131354.2507443-7-bugaevc@gmail.com> Diff: --- hurd/lookup-retry.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c index 99c981046f..62f94bbc92 100644 --- a/hurd/lookup-retry.c +++ b/hurd/lookup-retry.c @@ -277,7 +277,6 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) error_t err; struct host_basic_info hostinfo; mach_msg_type_number_t hostinfocnt = HOST_BASIC_INFO_COUNT; - char *p; /* XXX want client's host */ if (err = __host_info (__mach_host_self (), HOST_BASIC_INFO, (integer_t *) &hostinfo, @@ -288,13 +287,11 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) err = EGRATUITOUS; goto out; } - p = _itoa (hostinfo.cpu_subtype, &retryname[8], 10, 0); - *--p = '/'; - p = _itoa (hostinfo.cpu_type, &retryname[8], 10, 0); - if (p < retryname) + file_name = _itoa (hostinfo.cpu_subtype, &retryname[8], 10, 0); + *--file_name = '/'; + file_name = _itoa (hostinfo.cpu_type, file_name, 10, 0); + if (file_name < retryname) abort (); /* XXX write this right if this ever happens */ - if (p > retryname) - memmove (retryname, p, strlen(p) + 1); startdir = *result; } else
reply other threads:[~2023-04-29 15:01 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=20230429150116.990BE3858C50@sourceware.org \ --to=sthibaul@sourceware.org \ --cc=glibc-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).