On 11/8/20 11:21 PM, John Reiser wrote:
> Let's handle some preliminary errors in this thread on building nfs-utils, 
> before they spread even more.
> 
> 1. Be specific.  State the package name in both the Subject and the first 
> line of the body.
> This provides context which aids the scanning of Subjects and enables 
> detection and correction
> of copy+paste errors.
> 
> 2. The return value from both printf() and snprintf() with a format of 
> "%s/%s" is
>    s(trlen(str1) + 1 + strlen(str2))   /* +1: the '/' separator */
> [note that this is strlen() of the unconstrained destination array],
> and the number of bytes written (if not limited by the size parameter to 
> snprintf())
> is 1 more because of the terminating NUL byte '\0'.
> Thus the minimum size of the unconstrained destination is (2 + strlen(str1) + 
> strlen(str2)).
> 
> 3. Do not use "PATH_MAX + 1".  Almost always it indicates a programmer error.
> From /usr/include/linux/limits.h we see that
>    #define PATH_MAX        4096    /* # chars in a path name including nul */
> Increasing the size does not work: if (4096 <= strlen(path))  /* Yes, '<=' */
> then the Linux kernel will do something other than what you naively expect.
> The "destination too small" error condition for (rv = snprintf(array, size, 
> format, ...))
> is (size <= rv); using anything else is a bug.
By using PATH_MAX instead of PATH_MAX +1 and 
by using snprintf() instead of sprintf() and 
finally checking the return value of snprintf()
the error no longer exists.

> 
> 
> After taking care of those bugs above, and looking at the constants such as 
> '2147483645'
> and '2147483648' in the compiler's complaints, it is obvious that the 
> compiler erred
> when tracking the result value from some call to strlen().  If you want help 
> then
> please supply the complete source code.  I could not locate the downloadable 
> source for
>    [1] https://koji.fedoraproject.org/koji/taskinfo?taskID=55125502
> even after following several links.
If still interested here is the srpm [1] (the patch is in tmp.diff)

Thanks everyone for all the input!!! It was definitely appreciated!! 

steved.

[1] http://people.redhat.com/steved/.tmp/nfs-utils-2.5.2-1.fc34.src.rpm
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to