[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Kill strcpy and strcat

From: Pawel Kot
Subject: Re: [PATCH] Kill strcpy and strcat
Date: Wed, 7 Nov 2007 16:16:55 +0100


(anwering to myself)

On Nov 7, 2007 2:26 PM, Pawel Kot <address@hidden> wrote:
> Maybe somebody could tell me if there is a difference between:
> snprintf(buf, sizeof(buf), "%s", some_string);
> and
> strncpy(buf, some_string, sizeof(buf));
> buf[sizeof(buf) - 1] = 0;

If some_string is NULL, then strncpy will segfault.

I'd suggest using snprintf() in gnokii documentation. Any objections?

take care,
Pawel Kot

reply via email to

[Prev in Thread] Current Thread [Next in Thread]