Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 2004 16:06:39 -0400
From:      James Housley <jim@Thehousleys.net>
To:        "Thordur Ivar B." <thib@mi.is>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Where is strnlen() ?
Message-ID:  <411A7C4F.9060500@Thehousleys.net>
In-Reply-To: <20040811193254.6f0be2c2.thib@mi.is>
References:  <20040811193254.6f0be2c2.thib@mi.is>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Thordur Ivar B. wrote:
> While porting software from a friend wich was developed under Linux, I stumbled
> upon an error: src/socket.c:236: warning: implicit declaration of function
> `strnlen'
> 
> Now my programming experience is nothing to brag about but I wonder why strnlen
> is not a part of FreeBSD's libc. I think that the use of strlen() insted of
> strnlen() could resault in buffer-overflow risks and my fellows (most of them
> are more experienced in the art of programming say that bounds checking is
> always good.) 
> 

I see one small, specialiezed use.  That is in a structure were a string 
for max length doesn't get the terminator, this would prevent reading 
throught the rest of the data to find a null somewhere.

Jim

-- 
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
jeh@FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
It's always a long day, 86400 doesn't fit into a short.

[-- Attachment #2 --]
0	*H
010	+0	*H
	#00U0
	*H
0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0
040131191100Z
050130191100Z0^10UHousley10U*James10U
James Housley1"0 	*H
	jim@thehousleys.net0"0
	*H
0
%k׈7o_tg?@<_P.Eh;_{)SӻNKH)'M(W_w%ވ,UnJ13{㎊‹t	[lBg]ѢbkKZ3OXmuq2$=d8ݨiܠc[)"(Vln嗛xRE%H%'zm6;!nij0$c`
wӁX	ᝐCs00.0U0jim@thehousleys.net0U00
	*H
}Nrx4Ae+d)?O}ibqWSVَUր0QjL*m$A
"Vs̱8~—`0e&q$5]%ړN00U0
	*H
0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0
040131191100Z
050130191100Z0^10UHousley10U*James10U
James Housley1"0 	*H
	jim@thehousleys.net0"0
	*H
0
%k׈7o_tg?@<_P.Eh;_{)SӻNKH)'M(W_w%ވ,UnJ13{㎊‹t	[lBg]ѢbkKZ3OXmuq2$=d8ݨiܠc[)"(Vln嗛xRE%H%'zm6;!nij0$c`
wӁX	ᝐCs00.0U0jim@thehousleys.net0U00
	*H
}Nrx4Ae+d)?O}ibqWSVَUր0QjL*m$A
"Vs̱8~—`0e&q$5]%ړN0?0
0
	*H
010	UZA10UWestern Cape10U	Cape Town10U
Thawte Consulting1(0&UCertification Services Division1$0"UThawte Personal Freemail CA1+0)	*H
	personal-freemail@thawte.com0
030717000000Z
130716235959Z0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA00
	*H
0Ħ<UsUNʙZhup[v:aQP
0cZ,p+Z?qV˯<6$*+w=+>@dקe*TH<a@dr`00U00CU<0:08642http://crl.thawte.com/ThawtePersonalFreemailCA.crl0U0)U"0 010UPrivateLabel2-1380
	*H
HP.
fgCL!6-6/P p<ab:~t%Pb'qW%ݩ9 Oe_N4[5MwV!x!5$F]_eO1;070i0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0	+0	*H
	1	*H
0	*H
	1
040811200639Z0#	*H
	1~d/ :n0R	*H
	1E0C0
*H
0*H
0
*H
@0+0
*H
(0x	+71k0i0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0z*H
	1ki0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0
	*H
)NmNsŵ&unb/_J>xDPS*ͰYArU%U{okXw\stH#ĒM(|vXח_:ΔU/RMwU#s:hkkj&?V_ς%DmrzؠiwS+F(~M'EK誁R6IuN[L
v T͏NJZfjDU|@\
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?411A7C4F.9060500>