Re: [fossil-users] strcpy() vs strlcpy()?
On 22 Apr 2014 21:35:39 -0600 Andy Bradford amb-fos...@bradfords.org wrote: Hello, As of [2aaae64a59] compiling Fossil on OpenBSD results in a warning: bld/name.o(.text+0x11a): In function `test_ambiguous_cmd': ./src/name.c:742: warning: strcpy() is almost always misused, please use strlcpy() Is this something to be concerned about for Fossil? I know there are other parts of the Fossil build that use strcpy() but this is the first time Fossil proper has used it. Would it be better to use strlcpy()? Don't know, but strlcpy() exists only in *BSD libc, but no in GNU/Linux glibc or Windows. Thanks, Andy --- --- Eduardo Morras emorr...@yahoo.es ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] strcpy() vs strlcpy()?
Thus said Eduardo Morras on Wed, 23 Apr 2014 08:49:52 +0200: Don't know, but strlcpy() exists only in *BSD libc, but no in GNU/Linux glibc or Windows. Sure enough, guess I should RTFM a bit more. I looks like this isn't exactly an option then, and the strlcpy() that are used in src/sqlite3.c must be protected by #ifdef statements. I wonder what Fossil has been using for strcpy() up until now; maybe strncpy... Time to look at the source. Thanks, Andy -- TAI64 timestamp: 4000535766b6 ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
[fossil-users] strcpy() vs strlcpy()?
Hello, As of [2aaae64a59] compiling Fossil on OpenBSD results in a warning: bld/name.o(.text+0x11a): In function `test_ambiguous_cmd': ./src/name.c:742: warning: strcpy() is almost always misused, please use strlcpy() Is this something to be concerned about for Fossil? I know there are other parts of the Fossil build that use strcpy() but this is the first time Fossil proper has used it. Would it be better to use strlcpy()? --- src/name.c +++ src/name.c @@ -737,15 +737,15 @@ db_bind_int(ins, :cnt, i); db_bind_text(ins, :uuid, zUuid); db_step(ins); db_reset(ins); } -strcpy(zPrev, zUuid); +strlcpy(zPrev, zUuid, sizeof(zPrev)); } db_finalize(ins); db_finalize(q); db_prepare(q, SELECT uuid FROM dups ORDER BY length(uuid) DESC, uuid); while( db_step(q)==SQLITE_ROW ){ fossil_print(%s\n, db_column_text(q, 0)); } db_finalize(q); } Thanks, Andy -- TAI64 timestamp: 40005357352e ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users