Nmap Development mailing list archives
Re: [patch] fix strncpy() management
From: David Fifield <david () bamsoftware com>
Date: Wed, 4 Sep 2013 11:40:18 -0700
On Sun, Aug 25, 2013 at 10:27:42PM +0400, Vasily Kulikov wrote:
On Fri, Aug 16, 2013 at 21:09 -0700, David Fifield wrote:On Tue, Aug 13, 2013 at 12:04:36PM +0400, Vasily Kulikov wrote:The patch fixes several strncpy() calls to properly set '\0' in the end of the string. The bugs were found with the help of the following coccinelle script: All found cases were manually checked, some of them were false positives. Some code doesn't need = '\0', but needs changes to the size argument. strncpy() from libpcap/ need additional review as it looks like several strncats deliberately don't add zero at the end of the string to satisfy setsockopt/getsockopt API.Thank you for doing this check. Rather than manually zero the last byte, it were better to use the Strncpy function from nbase.I wanted the changes to be consistent with the surrounding code.
I'd prefer that you use Strncpy. It is already used in many places in Nmap. Would you revise the patch to use Strncpy? David Fifield _______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [patch] fix strncpy() management Vasily Kulikov (Aug 13)
- Re: [patch] fix strncpy() management David Fifield (Aug 16)
- Re: [patch] fix strncpy() management Vasily Kulikov (Aug 25)
- Re: [patch] fix strncpy() management David Fifield (Sep 04)
- Re: [patch] fix strncpy() management Vasily Kulikov (Aug 25)
- Re: [patch] fix strncpy() management David Fifield (Aug 16)