[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51356735.4020405@asianux.com>
Date: Tue, 05 Mar 2013 11:32:05 +0800
From: Chen Gang <gang.chen@...anux.com>
To: Ben Hutchings <bhutchings@...arflare.com>
CC: David Laight <David.Laight@...LAB.COM>,
venkat.x.venkatsubra@...cle.com,
David Miller <davem@...emloft.net>, rds-devel@....oracle.com,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] net/rds: using strlcpy instead of strncpy
于 2013年03月05日 11:16, Ben Hutchings 写道:
> I think it is wrong, and the code should be changed to do either:
>
> 1. Zero-initialise the whole of the name, then use strlcpy().
> 2. Keep using strncpy(), and also set the last byte of name to 0.
>
I think what I have done is just like your choice "2."
for me, I think they are equal:
- strncpy(ctr.name, names[i], sizeof(ctr.name) - 1);
+ strlcpy(ctr.name, names[i], sizeof(ctr.name));
strncpy(ctr.name, names[i], sizeof(ctr.name) - 1);
+ ctr.name[sizeof(ctr.name) - 1] = '\0';
>> > BTW:
>> > excuse me, maybe my reply will be late during this week.
>> > the reason:
>> > my father had a serious heart disease, and is in hospital.
>> > during these days, most of my time has to be in hospital.
>> > (God Bless, and thank Jesus Christ, my father is safe, now).
>> > within my company (Asianux), I also have something to do.
> Best wishes to you both.
thank you.
:-)
--
Chen Gang
Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists