X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.0 required=5.0 tests=BAYES_20,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org To: Subject: Re: src/winsup/cygwin ChangeLog dcrt0.cc X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Date: Fri, 27 Jan 2012 12:19:44 +0000 From: Chris January In-Reply-To: <25fbed8bb03f1d4ebf8de99b8be8bfbf@shell.sh.cvut.cz> References: <25fbed8bb03f1d4ebf8de99b8be8bfbf AT shell DOT sh DOT cvut DOT cz> Message-ID: X-Sender: chris AT atomice DOT net User-Agent: Roundcube Webmail/0.6 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q0RCZE1l001427 On 27.01.2012 10:46, Václav Zeman wrote: >> +#define is_dos_path(s) (isdrive(s) \ >> + || ((s)[0] == '\\' \ >> + && (s)[1] == '\\' \ >> + && isalpha ((s)[2]) \ >> + && strchr ((s) + 3, '\\'))) > Is it safe to access 2nd, 3rd and 4th characters of the word without > checking the length first? Yes, if s is a NUL-terminated string. If s[0] != '\0' (because, e.g., s[0] == '\\') then s[1] is valid; if s[1] != '\0' then s[2] is valid, and so on. Chris -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple