From: "Suresh babu V." <suresh.babu@wipro.com>
To: <linux-kernel@vger.kernel.org>
Subject: Problem with sethostname() ??
Date: Thu, 10 Oct 2002 12:13:28 +0530 [thread overview]
Message-ID: <003d01c27028$5784a9f0$630b720a@sureshbabu> (raw)
[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]
Hi,
While attempting for some testing with sethostname() call, I got
this problem . As explained in the man page the sethostname call is
failing(ret val = -1 & errno = EFAULT(14)) for invalid address and valid
length. But the problem is after running the following test, hostname is
getting reset to NULL. I tested in both 2.4 & 2.5 kernels.
Any comments on this??
----------------------------------
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
main()
{
int ret, errno;
unsigned short int len;
char host[50]="tmphost"; /* hostname max size is 64 */
errno = 0;
len = sizeof(host);
/* valid length and invalid address, expected err is EFAULT */
ret = sethostname((void *)-1, len);
printf("return val : %d, err no: %d \n",ret,errno);
}
-------------------------------------------------
I saw the code of sys_sethostname() function (sys.c) , in which
copy_from_user() is being called. I would like to know is it required to
validate the name argument before calling copy_from_user() to avoid such
problems.
We could expect similar problem in setdomainname() also in which
same sort of code is used.
PS : Please CC me your replies as I havn't subscribed to the list.
Thanks,
Suresh.
[-- Attachment #2: Wipro_Disclaimer.txt --]
[-- Type: text/plain, Size: 522 bytes --]
**************************Disclaimer**************************************************
Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged'
and 'confidential' and intended for use only by the individual or entity to which it is
addressed. You are notified that any use, copying or dissemination of the information
contained in the E-MAIL in any manner whatsoever is strictly prohibited.
****************************************************************************************
next reply other threads:[~2002-10-10 6:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-10 6:43 Suresh babu V. [this message]
2002-10-10 10:30 Saji Kumar VR
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='003d01c27028$5784a9f0$630b720a@sureshbabu' \
--to=suresh.babu@wipro.com \
--cc=linux-kernel@vger.kernel.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: link
Be 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
all inboxes | Powered by JetHome®