NetBSD-Bugs archive

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

re: bin/38201: Potential lack of null termination when copying a string



The following reply was made to PR bin/38201; it has been noted by GNATS.

From: matthew green <mrg%eterna.com.au@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, 
netbsd%happyjack.org@localhost
Subject: re: bin/38201: Potential lack of null termination when copying a 
string 
Date: Wed, 12 Mar 2008 12:35:01 +1100

     
     Since e->host is guaranteed to be longer than up->ut_host, and strncpy
     is used because up->ut_host might not be null terminated, the correct
     line would be:
        e->host[sizeof up->ut_host - 1] = 0;
 
 i haven't looked at the code but this will truncate one byte
 from ut_host (which is not a nul terminated string.)
 
 
 .mrg.
 


Home | Main Index | Thread Index | Old Index