Yes, this is a little irritating. Back in the time when I used to do C,
I always used strncpy and then stuck a '0' at the end of the new string.


-----Original Message-----
From: Dave Dyer [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 10, 2008 12:25 PM
To: Teg; General Discussion of SQLite Database; Teg; General Discussion
of SQLite Database
Subject: Re: [sqlite] strcpy and sqlite3_column_text


>
>strcpy(result->>ip_address,(const char*)pszData);

Strcpy is one of those evil "standard" c functions that 
no one should every use, because it copies an unlimited
and unknown amount of data into an obviously finite buffer.

If some joker puts a little extra data in a sqlite IP address,
and you've got a bug that could take forever to find.

Standard strncpy is also pretty evil, because it doesn't
guarantee a null at the end.

I know you're all too smart to be so sloppy, and this
little lecture is totally redundant and unnecessary.



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to