Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"I'm not a god, I was misquoted." -- Lister, Red Dwarf


devel / comp.lang.c / Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

SubjectAuthor
* Variadic functionsMalcolm McLean
+- Re: Variadic functionsKaz Kylheku
+- Re: Variadic functionsKeith Thompson
+- Re: Variadic functionsLawrence D'Oliveiro
+- Re: Variadic functionsJames Kuyper
+* Re: Variadic functionsJanis Papanagnou
|`* Re: Variadic functionsMalcolm McLean
| +* Re: Variadic functionsSpiros Bousbouras
| |+* Re: Variadic functionsMalcolm McLean
| ||`- Re: Variadic functionsRichard Harnden
| |`* Re: Variadic functionsBlue-Maned_Hawk
| | `* Re: Variadic functionsLawrence D'Oliveiro
| |  +* Re: Variadic functionsMalcolm McLean
| |  |+- Re: Variadic functionsDavid Brown
| |  |`* Re: Variadic functionsScott Lurndal
| |  | +* Re: Variadic functionsLawrence D'Oliveiro
| |  | |`* Re: Variadic functionsDavid Brown
| |  | | +* Re: Variadic functionsJanis Papanagnou
| |  | | |`- Re: Variadic functionsDavid Brown
| |  | | +* Re: Variadic functionsLawrence D'Oliveiro
| |  | | |`* Re: Variadic functionsDavid Brown
| |  | | | `* Re: Variadic functionsLawrence D'Oliveiro
| |  | | |  `* Re: Variadic functionsKenny McCormack
| |  | | |   +- Re: Variadic functionsKaz Kylheku
| |  | | |   `- Re: Variadic functionsLawrence D'Oliveiro
| |  | | `* Re: Variadic functionsMalcolm McLean
| |  | |  +- Re: Variadic functionsKaz Kylheku
| |  | |  +- Re: Variadic functionsJames Kuyper
| |  | |  +- Re: Variadic functionsDavid Brown
| |  | |  `* Re: Variadic functionsKeith Thompson
| |  | |   `* Re: Variadic functionsMalcolm McLean
| |  | |    +* Re: Variadic functionsScott Lurndal
| |  | |    |+- Re: strings (was Re: Variadic functions)Lawrence D'Oliveiro
| |  | |    |`- Re: Variadic functionsDavid Brown
| |  | |    +* Re: Variadic functionsKaz Kylheku
| |  | |    |`- Re: Variadic functionsMalcolm McLean
| |  | |    `* Re: Variadic functionsDavid Brown
| |  | |     `* Re: Variadic functionsMalcolm McLean
| |  | |      `* Re: Variadic functionsDavid Brown
| |  | |       `* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Lawrence D'Oliveiro
| |  | |        +- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Chris M. Thomasson
| |  | |        +* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)bart
| |  | |        |`* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Lawrence D'Oliveiro
| |  | |        | +* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)bart
| |  | |        | |`- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Lawrence D'Oliveiro
| |  | |        | `* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Tim Rentsch
| |  | |        |  `* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Lawrence D'Oliveiro
| |  | |        |   +- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Kaz Kylheku
| |  | |        |   `* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Kenny McCormack
| |  | |        |    +- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Kaz Kylheku
| |  | |        |    `- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Lawrence D'Oliveiro
| |  | |        +- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Kenny McCormack
| |  | |        +* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Keith Thompson
| |  | |        |`* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Lawrence D'Oliveiro
| |  | |        | `* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Keith Thompson
| |  | |        |  +- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Lawrence D'Oliveiro
| |  | |        |  `* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)jak
| |  | |        |   `- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)David Brown
| |  | |        +- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)David Brown
| |  | |        `* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Malcolm McLean
| |  | |         `* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Chris M. Thomasson
| |  | |          `* Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)David Brown
| |  | |           `- Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)Chris M. Thomasson
| |  | `* Re: Variadic functionsBlue-Maned_Hawk
| |  |  `* Re: Variadic functionsLawrence D'Oliveiro
| |  |   `* Re: Variadic functionsDavid Brown
| |  |    +* Re: Variadic functionsKaz Kylheku
| |  |    |+- Re: Variadic functionsScott Lurndal
| |  |    |+* Re: Variadic functionsKeith Thompson
| |  |    ||`* Re: Variadic functionsDavid Brown
| |  |    || `- Re: Variadic functionsKeith Thompson
| |  |    |+- Re: Variadic functionsJames Kuyper
| |  |    |`* Re: Variadic functionsDavid Brown
| |  |    | `* Re: Variadic functionsKeith Thompson
| |  |    |  `- Re: Variadic functionsDavid Brown
| |  |    +* Re: Variadic functionsLawrence D'Oliveiro
| |  |    |`- Re: Variadic functionsDavid Brown
| |  |    `* Re: Variadic functionsBlue-Maned_Hawk
| |  |     `- Re: Variadic functionsDavid Brown
| |  `- Re: Variadic functionsBlue-Maned_Hawk
| +* Re: Variadic functionsLawrence D'Oliveiro
| |`* Re: Variadic functionsMalcolm McLean
| | +- Re: Variadic functionsLawrence D'Oliveiro
| | +* Re: Variadic functionsbart
| | |+* Re: Variadic functionsMalcolm McLean
| | ||`* Re: Variadic functionsDavid Brown
| | || `* Re: Variadic functionsMalcolm McLean
| | ||  `* Re: Variadic functionsDavid Brown
| | ||   `* Re: Variadic functionsMalcolm McLean
| | ||    +* Re: Variadic functionsDavid Brown
| | ||    |`* Re: Variadic functionsMalcolm McLean
| | ||    | `* Re: Variadic functionsDavid Brown
| | ||    |  `* Re: Variadic functionsMalcolm McLean
| | ||    |   `- Re: Variadic functionsDavid Brown
| | ||    `* Re: Variadic functionsKaz Kylheku
| | ||     `* Re: Variadic functionsMalcolm McLean
| | ||      `- Re: Variadic functionsKaz Kylheku
| | |`- Re: Variadic functionsBlue-Maned_Hawk
| | +- Re: Variadic functionsKeith Thompson
| | `* Re: Variadic functionsLawrence D'Oliveiro
| |  `- Re: Variadic functionsKaz Kylheku
| `* Re: Variadic functionsLawrence D'Oliveiro
+* Re: Variadic functionsTim Rentsch
+- Re: Variadic functionsBlue-Maned_Hawk
`- Re: Variadic functionsChris M. Thomasson

Pages:12345
Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<up607u$opl$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31888&group=comp.lang.c#31888

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Sun, 28 Jan 2024 16:43:41 +0000
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <up607u$opl$1@dont-email.me>
References: <uoed9m$387sh$1@dont-email.me> <uog6fs$3klco$1@dont-email.me>
<uoga8t$3l6mu$1@dont-email.me> <Kdccf9Gr26AQrYzxL@bongo-ra.co>
<pan$b84f3$321a3e4$17747387$71cad685@invalid.invalid>
<uomu5q$uj61$2@dont-email.me> <uonteh$16sb4$2@dont-email.me>
<xVQrN.249990$Wp_8.4423@fx17.iad> <uopc7g$1f17i$2@dont-email.me>
<uoqie3$1o25r$1@dont-email.me> <uou6op$2d0m5$1@dont-email.me>
<87sf2l2od8.fsf@nosuchdomain.example.com> <uour9j$2gkc8$1@dont-email.me>
<up0i59$2tm6a$1@dont-email.me> <up24qi$393mt$1@dont-email.me>
<up34s6$3dpki$1@dont-email.me> <up3q66$3hbk7$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 28 Jan 2024 16:43:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e9a96cb9e186eace9e5fe757c18f0ec3";
logging-data="25397"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OCrtpq91+29oLmHKYuU4I7PskkAYXV8w="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:u7bcABzNsELN8IfCf74Fu4Q1AJ0=
In-Reply-To: <up3q66$3hbk7$5@dont-email.me>
Content-Language: en-GB
 by: Malcolm McLean - Sun, 28 Jan 2024 16:43 UTC

On 27/01/2024 20:48, Lawrence D'Oliveiro wrote:
> On Sat, 27 Jan 2024 15:44:22 +0100, David Brown wrote:
>
>> Whether a program with strcat, or a program with strncat, is correct or
>> not depends on the specifications for the program.
>
> Can a program that uses strcat be “correct”? In theory, yes. In practice,
> code that uses such misbegotten functions has a high probability of having
> associated security vulnerabilities like buffer overflows in it. That’s
> why we avoid same.
>
For me security vulnerablities of that type aren't a big issue. Whilst
someone could potentially exploit that vulnerability to run unspecified
code, he'd find it very difficult to deploy the exploit to a paying
customer. We've never had a case of that sort of thing.

But in some environments, yes this is a serious concern. You rely onthe
strings being checked for length eslewhere, and it's not at all unlikely
that those checks could be evaded somehow.

--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<up69ms$29an$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31905&group=comp.lang.c#31905

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Sun, 28 Jan 2024 11:25:16 -0800
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <up69ms$29an$2@dont-email.me>
References: <uoed9m$387sh$1@dont-email.me> <uog6fs$3klco$1@dont-email.me>
<uoga8t$3l6mu$1@dont-email.me> <Kdccf9Gr26AQrYzxL@bongo-ra.co>
<pan$b84f3$321a3e4$17747387$71cad685@invalid.invalid>
<uomu5q$uj61$2@dont-email.me> <uonteh$16sb4$2@dont-email.me>
<xVQrN.249990$Wp_8.4423@fx17.iad> <uopc7g$1f17i$2@dont-email.me>
<uoqie3$1o25r$1@dont-email.me> <uou6op$2d0m5$1@dont-email.me>
<87sf2l2od8.fsf@nosuchdomain.example.com> <uour9j$2gkc8$1@dont-email.me>
<up0i59$2tm6a$1@dont-email.me> <up24qi$393mt$1@dont-email.me>
<up34s6$3dpki$1@dont-email.me> <up3q66$3hbk7$5@dont-email.me>
<up607u$opl$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 28 Jan 2024 19:25:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9fe4cfb1338e5b9f0f0e57f1cea759c7";
logging-data="75095"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1xH5XsCbRzHu0/C17FUAJIEPKrIez6tY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:3zh17k6YFlN5UG+GZQc+GTIVLdE=
Content-Language: en-US
In-Reply-To: <up607u$opl$1@dont-email.me>
 by: Chris M. Thomasson - Sun, 28 Jan 2024 19:25 UTC

On 1/28/2024 8:43 AM, Malcolm McLean wrote:
> On 27/01/2024 20:48, Lawrence D'Oliveiro wrote:
>> On Sat, 27 Jan 2024 15:44:22 +0100, David Brown wrote:
>>
>>> Whether a program with strcat, or a program with strncat, is correct or
>>> not depends on the specifications for the program.
>>
>> Can a program that uses strcat be “correct”? In theory, yes. In practice,
>> code that uses such misbegotten functions has a high probability of
>> having
>> associated security vulnerabilities like buffer overflows in it. That’s
>> why we avoid same.
> >
> For me security vulnerablities of that type aren't a big issue. Whilst
> someone could potentially exploit that vulnerability to run unspecified
> code, he'd find it very difficult to deploy the exploit to a paying
> customer. We've never had a case of that sort of thing.
>
> But in some environments, yes this is a serious concern. You rely onthe
> strings being checked for length eslewhere, and it's not at all unlikely
> that those checks could be evaded somehow.
>

strcat can be used correctly. A person that juggles chainsaws, yet has
no arms and legs, well, shit happens... ;^)

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<up7lgp$cc1s$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31927&group=comp.lang.c#31927

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Mon, 29 Jan 2024 08:52:57 +0100
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <up7lgp$cc1s$1@dont-email.me>
References: <uoed9m$387sh$1@dont-email.me> <uog6fs$3klco$1@dont-email.me>
<uoga8t$3l6mu$1@dont-email.me> <Kdccf9Gr26AQrYzxL@bongo-ra.co>
<pan$b84f3$321a3e4$17747387$71cad685@invalid.invalid>
<uomu5q$uj61$2@dont-email.me> <uonteh$16sb4$2@dont-email.me>
<xVQrN.249990$Wp_8.4423@fx17.iad> <uopc7g$1f17i$2@dont-email.me>
<uoqie3$1o25r$1@dont-email.me> <uou6op$2d0m5$1@dont-email.me>
<87sf2l2od8.fsf@nosuchdomain.example.com> <uour9j$2gkc8$1@dont-email.me>
<up0i59$2tm6a$1@dont-email.me> <up24qi$393mt$1@dont-email.me>
<up34s6$3dpki$1@dont-email.me> <up3q66$3hbk7$5@dont-email.me>
<up607u$opl$1@dont-email.me> <up69ms$29an$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 29 Jan 2024 07:52:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="97a86bc186f2ce7a3f5aa28c9d36f604";
logging-data="405564"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Vromon8yHIMe09vRXARlDFo17entClXU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:zLssROydDhxrWRVzYJ5pwC8YjKI=
Content-Language: en-GB
In-Reply-To: <up69ms$29an$2@dont-email.me>
 by: David Brown - Mon, 29 Jan 2024 07:52 UTC

On 28/01/2024 20:25, Chris M. Thomasson wrote:
> On 1/28/2024 8:43 AM, Malcolm McLean wrote:
>> On 27/01/2024 20:48, Lawrence D'Oliveiro wrote:
>>> On Sat, 27 Jan 2024 15:44:22 +0100, David Brown wrote:
>>>
>>>> Whether a program with strcat, or a program with strncat, is correct or
>>>> not depends on the specifications for the program.
>>>
>>> Can a program that uses strcat be “correct”? In theory, yes. In
>>> practice,
>>> code that uses such misbegotten functions has a high probability of
>>> having
>>> associated security vulnerabilities like buffer overflows in it. That’s
>>> why we avoid same.
>>  >
>> For me security vulnerablities of that type aren't a big issue. Whilst
>> someone could potentially exploit that vulnerability to run
>> unspecified code, he'd find it very difficult to deploy the exploit to
>> a paying customer. We've never had a case of that sort of thing.
>>
>> But in some environments, yes this is a serious concern. You rely
>> onthe strings being checked for length eslewhere, and it's not at all
>> unlikely that those checks could be evaded somehow.
>>
>
> strcat can be used correctly. A person that juggles chainsaws, yet has
> no arms and legs, well, shit happens... ;^)

The trick is to use juggling chainsaws, not regular ones (there are big
differences), and to know what you are doing with them. Accidents are
very rare. Juggling accidents come from people trying dangerous things
without proper training, or without appropriate safety precautions, or
because they think it will make them look smart.

So it is not /that/ different from programming!

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<864jevdhsm.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31952&group=comp.lang.c#31952

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Mon, 29 Jan 2024 12:08:09 -0800
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <864jevdhsm.fsf@linuxsc.com>
References: <uoed9m$387sh$1@dont-email.me> <uog6fs$3klco$1@dont-email.me> <uoga8t$3l6mu$1@dont-email.me> <Kdccf9Gr26AQrYzxL@bongo-ra.co> <pan$b84f3$321a3e4$17747387$71cad685@invalid.invalid> <uomu5q$uj61$2@dont-email.me> <uonteh$16sb4$2@dont-email.me> <xVQrN.249990$Wp_8.4423@fx17.iad> <uopc7g$1f17i$2@dont-email.me> <uoqie3$1o25r$1@dont-email.me> <uou6op$2d0m5$1@dont-email.me> <87sf2l2od8.fsf@nosuchdomain.example.com> <uour9j$2gkc8$1@dont-email.me> <up0i59$2tm6a$1@dont-email.me> <up24qi$393mt$1@dont-email.me> <up34s6$3dpki$1@dont-email.me> <up3q66$3hbk7$5@dont-email.me> <up3rqa$3hnls$1@dont-email.me> <up44aq$3io8t$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="cd3adc4099bd68559ae259bfa6cea774";
logging-data="633582"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9mpnAmxmakphHlkYUGUQZ1InK77duoNI="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:zPFJo5/8CdPIKy9YBTzTItBiwy0=
sha1:FmqJ5m54EWNqKWjX+cB0kBEzJaY=
 by: Tim Rentsch - Mon, 29 Jan 2024 20:08 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:

[..how would one write a safe set of string functions?..]

> Don't. Use an alternative function instead.
>
> <https://manpages.debian.org/7/string_copying.en.html>

As documentation that page is truly horrendous.

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<up98kc$kvd2$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31962&group=comp.lang.c#31962

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.network!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Mon, 29 Jan 2024 14:25:17 -0800
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <up98kc$kvd2$2@dont-email.me>
References: <uoed9m$387sh$1@dont-email.me> <uog6fs$3klco$1@dont-email.me>
<uoga8t$3l6mu$1@dont-email.me> <Kdccf9Gr26AQrYzxL@bongo-ra.co>
<pan$b84f3$321a3e4$17747387$71cad685@invalid.invalid>
<uomu5q$uj61$2@dont-email.me> <uonteh$16sb4$2@dont-email.me>
<xVQrN.249990$Wp_8.4423@fx17.iad> <uopc7g$1f17i$2@dont-email.me>
<uoqie3$1o25r$1@dont-email.me> <uou6op$2d0m5$1@dont-email.me>
<87sf2l2od8.fsf@nosuchdomain.example.com> <uour9j$2gkc8$1@dont-email.me>
<up0i59$2tm6a$1@dont-email.me> <up24qi$393mt$1@dont-email.me>
<up34s6$3dpki$1@dont-email.me> <up3q66$3hbk7$5@dont-email.me>
<up607u$opl$1@dont-email.me> <up69ms$29an$2@dont-email.me>
<up7lgp$cc1s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 29 Jan 2024 22:25:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="79e47a7daf77a3dc87926c1beb8fd8a3";
logging-data="687522"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JEqgKQY8Mljn07R9k84Udh4P3vnUd+PM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:sGNRgBbjOUohZsD5nia1Kwq9sE4=
Content-Language: en-US
In-Reply-To: <up7lgp$cc1s$1@dont-email.me>
 by: Chris M. Thomasson - Mon, 29 Jan 2024 22:25 UTC

On 1/28/2024 11:52 PM, David Brown wrote:
> On 28/01/2024 20:25, Chris M. Thomasson wrote:
>> On 1/28/2024 8:43 AM, Malcolm McLean wrote:
>>> On 27/01/2024 20:48, Lawrence D'Oliveiro wrote:
>>>> On Sat, 27 Jan 2024 15:44:22 +0100, David Brown wrote:
>>>>
>>>>> Whether a program with strcat, or a program with strncat, is
>>>>> correct or
>>>>> not depends on the specifications for the program.
>>>>
>>>> Can a program that uses strcat be “correct”? In theory, yes. In
>>>> practice,
>>>> code that uses such misbegotten functions has a high probability of
>>>> having
>>>> associated security vulnerabilities like buffer overflows in it. That’s
>>>> why we avoid same.
>>>  >
>>> For me security vulnerablities of that type aren't a big issue.
>>> Whilst someone could potentially exploit that vulnerability to run
>>> unspecified code, he'd find it very difficult to deploy the exploit
>>> to a paying customer. We've never had a case of that sort of thing.
>>>
>>> But in some environments, yes this is a serious concern. You rely
>>> onthe strings being checked for length eslewhere, and it's not at all
>>> unlikely that those checks could be evaded somehow.
>>>
>>
>> strcat can be used correctly. A person that juggles chainsaws, yet has
>> no arms and legs, well, shit happens... ;^)
>
> The trick is to use juggling chainsaws, not regular ones (there are big
> differences), and to know what you are doing with them.  Accidents are
> very rare.  Juggling accidents come from people trying dangerous things
> without proper training, or without appropriate safety precautions, or
> because they think it will make them look smart.
>
> So it is not /that/ different from programming!
>

You got it! Big time David. :^)

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<up9d6f$lmi3$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31964&group=comp.lang.c#31964

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Mon, 29 Jan 2024 23:43:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <up9d6f$lmi3$2@dont-email.me>
References: <uoed9m$387sh$1@dont-email.me> <uog6fs$3klco$1@dont-email.me>
<uoga8t$3l6mu$1@dont-email.me> <Kdccf9Gr26AQrYzxL@bongo-ra.co>
<pan$b84f3$321a3e4$17747387$71cad685@invalid.invalid>
<uomu5q$uj61$2@dont-email.me> <uonteh$16sb4$2@dont-email.me>
<xVQrN.249990$Wp_8.4423@fx17.iad> <uopc7g$1f17i$2@dont-email.me>
<uoqie3$1o25r$1@dont-email.me> <uou6op$2d0m5$1@dont-email.me>
<87sf2l2od8.fsf@nosuchdomain.example.com> <uour9j$2gkc8$1@dont-email.me>
<up0i59$2tm6a$1@dont-email.me> <up24qi$393mt$1@dont-email.me>
<up34s6$3dpki$1@dont-email.me> <up3q66$3hbk7$5@dont-email.me>
<up3rqa$3hnls$1@dont-email.me> <up44aq$3io8t$4@dont-email.me>
<864jevdhsm.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 29 Jan 2024 23:43:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ba17ffef95be9ddc6f864a9afa7ca434";
logging-data="711235"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ug4fGmtL09dFHUlspL6hH"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:QpcskByV+SJEpyzWw9YKVCoSRdM=
 by: Lawrence D'Oliv - Mon, 29 Jan 2024 23:43 UTC

On Mon, 29 Jan 2024 12:08:09 -0800, Tim Rentsch wrote:

> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
> [..how would one write a safe set of string functions?..]
>
>> Don't. Use an alternative function instead.
>>
>> <https://manpages.debian.org/7/string_copying.en.html>
>
> As documentation that page is truly horrendous.

As with anything open-source, feel free to show us how you would do
better.

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<20240129165818.140@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31970&group=comp.lang.c#31970

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Tue, 30 Jan 2024 01:02:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <20240129165818.140@kylheku.com>
References: <uoed9m$387sh$1@dont-email.me> <uog6fs$3klco$1@dont-email.me>
<uoga8t$3l6mu$1@dont-email.me> <Kdccf9Gr26AQrYzxL@bongo-ra.co>
<pan$b84f3$321a3e4$17747387$71cad685@invalid.invalid>
<uomu5q$uj61$2@dont-email.me> <uonteh$16sb4$2@dont-email.me>
<xVQrN.249990$Wp_8.4423@fx17.iad> <uopc7g$1f17i$2@dont-email.me>
<uoqie3$1o25r$1@dont-email.me> <uou6op$2d0m5$1@dont-email.me>
<87sf2l2od8.fsf@nosuchdomain.example.com> <uour9j$2gkc8$1@dont-email.me>
<up0i59$2tm6a$1@dont-email.me> <up24qi$393mt$1@dont-email.me>
<up34s6$3dpki$1@dont-email.me> <up3q66$3hbk7$5@dont-email.me>
<up3rqa$3hnls$1@dont-email.me> <up44aq$3io8t$4@dont-email.me>
<864jevdhsm.fsf@linuxsc.com> <up9d6f$lmi3$2@dont-email.me>
Injection-Date: Tue, 30 Jan 2024 01:02:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="aa3290a72f6c22d61c05503829253c16";
logging-data="730862"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DRS0SHJCX7tyWWJ2FweVMJEg4kclAPuc="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:rtu5IwTDsQ1Cc7XLZu9uNj2zAi4=
 by: Kaz Kylheku - Tue, 30 Jan 2024 01:02 UTC

On 2024-01-29, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> On Mon, 29 Jan 2024 12:08:09 -0800, Tim Rentsch wrote:
>
>> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>>
>> [..how would one write a safe set of string functions?..]
>>
>>> Don't. Use an alternative function instead.
>>>
>>> <https://manpages.debian.org/7/string_copying.en.html>
>>
>> As documentation that page is truly horrendous.
>
> As with anything open-source, feel free to show us how you would do
> better.

The functions *are already documented* in glibc's manual.

https://sourceware.org/glibc/manual/html_mono/libc.html

where they are covered with much less pontification, belaboring and
rambling.

"The simplest character sequence copying function is mempcpy(3)"

What? According to what simplicity measure? This opinion bit,
like many others, adds no value.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<up9ivb$m0i7$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31972&group=comp.lang.c#31972

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Tue, 30 Jan 2024 01:21:47 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <up9ivb$m0i7$1@news.xmission.com>
References: <uoed9m$387sh$1@dont-email.me> <up44aq$3io8t$4@dont-email.me> <864jevdhsm.fsf@linuxsc.com> <up9d6f$lmi3$2@dont-email.me>
Injection-Date: Tue, 30 Jan 2024 01:21:47 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="721479"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Tue, 30 Jan 2024 01:21 UTC

In article <up9d6f$lmi3$2@dont-email.me>,
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>On Mon, 29 Jan 2024 12:08:09 -0800, Tim Rentsch wrote:
>
>> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>>
>> [..how would one write a safe set of string functions?..]
>>
>>> Don't. Use an alternative function instead.
>>>
>>> <https://manpages.debian.org/7/string_copying.en.html>
>>
>> As documentation that page is truly horrendous.
>
>As with anything open-source, feel free to show us how you would do
>better.

This is such a crap argument.

Everything says shi - I mean, stuff like this, but it just such a
ridiculous argument.

--
In American politics, there are two things you just don't f*ck with:

1) Goldman Sachs
2) The military/industrial complex

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<20240129172703.55@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31974&group=comp.lang.c#31974

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Tue, 30 Jan 2024 01:28:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <20240129172703.55@kylheku.com>
References: <uoed9m$387sh$1@dont-email.me> <up44aq$3io8t$4@dont-email.me>
<864jevdhsm.fsf@linuxsc.com> <up9d6f$lmi3$2@dont-email.me>
<up9ivb$m0i7$1@news.xmission.com>
Injection-Date: Tue, 30 Jan 2024 01:28:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="aa3290a72f6c22d61c05503829253c16";
logging-data="738675"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19h9ye2U5fz38QQvm8DPvKyKaGQpAiRowQ="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:php4m/0hZ5joecc4uzEJlfoDdUc=
 by: Kaz Kylheku - Tue, 30 Jan 2024 01:28 UTC

On 2024-01-30, Kenny McCormack <gazelle@shell.xmission.com> wrote:
> In article <up9d6f$lmi3$2@dont-email.me>,
> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>On Mon, 29 Jan 2024 12:08:09 -0800, Tim Rentsch wrote:
>>
>>> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>>>
>>> [..how would one write a safe set of string functions?..]
>>>
>>>> Don't. Use an alternative function instead.
>>>>
>>>> <https://manpages.debian.org/7/string_copying.en.html>
>>>
>>> As documentation that page is truly horrendous.
>>
>>As with anything open-source, feel free to show us how you would do
>>better.
>
> This is such a crap argument.
>
> Everything says shi - I mean, stuff like this, but it just such a
> ridiculous argument.

Especially given that the Linux Man Pages Project could do better just
by abstaining from writing write poor documentation for which there
exist better sources.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<up9jvh$mj5f$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31975&group=comp.lang.c#31975

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Tue, 30 Jan 2024 01:38:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <up9jvh$mj5f$1@dont-email.me>
References: <uoed9m$387sh$1@dont-email.me> <up44aq$3io8t$4@dont-email.me>
<864jevdhsm.fsf@linuxsc.com> <up9d6f$lmi3$2@dont-email.me>
<up9ivb$m0i7$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Jan 2024 01:38:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ba17ffef95be9ddc6f864a9afa7ca434";
logging-data="740527"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hjTqCMCz8bWqmoKdjp/Jg"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:EbBLU9ujiPupvbzZneahWtl+xh4=
 by: Lawrence D'Oliv - Tue, 30 Jan 2024 01:38 UTC

On Tue, 30 Jan 2024 01:21:47 -0000 (UTC), Kenny McCormack wrote:

> In article <up9d6f$lmi3$2@dont-email.me>,
>
> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>On Mon, 29 Jan 2024 12:08:09 -0800, Tim Rentsch wrote:
>>
>>> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>>>
>>> [..how would one write a safe set of string functions?..]
>>>
>>>> Don't. Use an alternative function instead.
>>>>
>>>> <https://manpages.debian.org/7/string_copying.en.html>
>>>
>>> As documentation that page is truly horrendous.
>>
>>As with anything open-source, feel free to show us how you would do
>>better.
>
> This is such a crap argument.

As the saying does: “put up or shut up”.

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<upaetn$u6lr$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31995&group=comp.lang.c#31995

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Tue, 30 Jan 2024 10:18:48 +0100
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <upaetn$u6lr$1@dont-email.me>
References: <uoed9m$387sh$1@dont-email.me> <uog6fs$3klco$1@dont-email.me>
<uoga8t$3l6mu$1@dont-email.me> <Kdccf9Gr26AQrYzxL@bongo-ra.co>
<pan$b84f3$321a3e4$17747387$71cad685@invalid.invalid>
<uomu5q$uj61$2@dont-email.me> <uonteh$16sb4$2@dont-email.me>
<xVQrN.249990$Wp_8.4423@fx17.iad> <uopc7g$1f17i$2@dont-email.me>
<uoqie3$1o25r$1@dont-email.me> <uou6op$2d0m5$1@dont-email.me>
<87sf2l2od8.fsf@nosuchdomain.example.com> <uour9j$2gkc8$1@dont-email.me>
<up0i59$2tm6a$1@dont-email.me> <up24qi$393mt$1@dont-email.me>
<up34s6$3dpki$1@dont-email.me> <up3q66$3hbk7$5@dont-email.me>
<87o7d61d48.fsf@nosuchdomain.example.com> <up49tp$3jopf$3@dont-email.me>
<87y1caz07r.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Jan 2024 09:18:50 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1498f6aa3e10a27c42846862cf34e7d5";
logging-data="989883"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wiArLac/8inbmYEFv6GHT"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:5fUN3TvwFXQQptGrdyzsdxP7zh4=
In-Reply-To: <87y1caz07r.fsf@nosuchdomain.example.com>
 by: jak - Tue, 30 Jan 2024 09:18 UTC

Keith Thompson ha scritto:
> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>> On Sat, 27 Jan 2024 17:05:27 -0800, Keith Thompson wrote:
>>> Yes, you can introduce a buffer overflow if you
>>> modify the code carelessly. So don't do that.
>>
>> Adding an explicit buffer size provides an additional check. It helps
>> reduce the incidence of such “carelessness”. Not completely, but it helps.
>
> Sure. It also requires extra work, and introduce more opportunities for
> errors if you specify the size incorrectly.
>
> There are languages that handle this kind of thing differently, where
> the size is inherently associated with each array or string object or
> value, and therefore the programmer doesn't have to specify it at all.
> C is not one of those languages.
>
> You seemed to be implying that strcpy() and strcat() cannot ever be used
> safely, and should not ever be used at all. It was that extreme
> statement that I was trying to refute. Of course using strcpy() or
> strcat() with user-provided input without checking:
>
> char buf[80]
> strcpy(buf, argv[1]);
> strcat(buf, argv[2]);

If someone writes a piece of code like this, then he is a programmer who
tries to use the C language and not a "C programmer". Code like that you
write it only when you do small tests for yourself.

>
> is dangerous. Just as 1+1 is perfectly safe, but n+1 is potentially
> dangerous if n might be equal to INT_MAX.
>

Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)

<upasof$10euf$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=32002&group=comp.lang.c#32002

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Bad String Functions; Bad Bad Bad (was Re: Variadic functions)
Date: Tue, 30 Jan 2024 14:14:55 +0100
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <upasof$10euf$1@dont-email.me>
References: <uoed9m$387sh$1@dont-email.me> <uog6fs$3klco$1@dont-email.me>
<uoga8t$3l6mu$1@dont-email.me> <Kdccf9Gr26AQrYzxL@bongo-ra.co>
<pan$b84f3$321a3e4$17747387$71cad685@invalid.invalid>
<uomu5q$uj61$2@dont-email.me> <uonteh$16sb4$2@dont-email.me>
<xVQrN.249990$Wp_8.4423@fx17.iad> <uopc7g$1f17i$2@dont-email.me>
<uoqie3$1o25r$1@dont-email.me> <uou6op$2d0m5$1@dont-email.me>
<87sf2l2od8.fsf@nosuchdomain.example.com> <uour9j$2gkc8$1@dont-email.me>
<up0i59$2tm6a$1@dont-email.me> <up24qi$393mt$1@dont-email.me>
<up34s6$3dpki$1@dont-email.me> <up3q66$3hbk7$5@dont-email.me>
<87o7d61d48.fsf@nosuchdomain.example.com> <up49tp$3jopf$3@dont-email.me>
<87y1caz07r.fsf@nosuchdomain.example.com> <upaetn$u6lr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Jan 2024 13:14:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="320c50a7312db09d065981adb5070632";
logging-data="1063887"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ySkP2WS21ovTZg1H/uxCEVN8wz3n8Y7Q="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:RkS1Pz9yPFcDq+KwcvT6DtGSkUo=
Content-Language: en-GB
In-Reply-To: <upaetn$u6lr$1@dont-email.me>
 by: David Brown - Tue, 30 Jan 2024 13:14 UTC

On 30/01/2024 10:18, jak wrote:
> Keith Thompson ha scritto:
>> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>>> On Sat, 27 Jan 2024 17:05:27 -0800, Keith Thompson wrote:
>>>> Yes, you can introduce a buffer overflow if you
>>>> modify the code carelessly.  So don't do that.
>>>
>>> Adding an explicit buffer size provides an additional check. It helps
>>> reduce the incidence of such “carelessness”. Not completely, but it
>>> helps.
>>
>> Sure.  It also requires extra work, and introduce more opportunities for
>> errors if you specify the size incorrectly.
>>
>> There are languages that handle this kind of thing differently, where
>> the size is inherently associated with each array or string object or
>> value, and therefore the programmer doesn't have to specify it at all.
>> C is not one of those languages.
>>
>> You seemed to be implying that strcpy() and strcat() cannot ever be used
>> safely, and should not ever be used at all.  It was that extreme
>> statement that I was trying to refute.  Of course using strcpy() or
>> strcat() with user-provided input without checking:
>>
>>      char buf[80]
>>      strcpy(buf, argv[1]);
>>      strcat(buf, argv[2]);
>
> If someone writes a piece of code like this, then he is a programmer who
> tries to use the C language and not a "C programmer". Code like that you
> write it only when you do small tests for yourself.
>

It is fine as long as it is used according to specifications - just like
any other program.

You would not want to write code like this and release it to "the great
unwashed", who would not bother reading the specifications, and would
not follow them even if they read them. You would not release it
somewhere where using it outside the specifications could be a problem
for the security, or stability of a system, or otherwise cause trouble.

But there are a very large number of programs, not just trivial or
private test programs, which are written to be used only in particular
circumstances or in particular ways. They may only be run from other
front-end or driver programs - ones that run them appropriately. They
may be run only be qualified and trained people. And the programmer
could be perfectly justified in thinking that any sensible user will use
the program as intended, without problem. Ignorant users won't get
anywhere with it even if they find it, and malicious users can't do
worse than they could do with "sudo rm -rf /", which is easier to abuse.

As Keith said, code like that is dangerous - that does not mean it is wrong.

>>
>> is dangerous.  Just as 1+1 is perfectly safe, but n+1 is potentially
>> dangerous if n might be equal to INT_MAX.
>>
>

Pages:12345
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor