r16203: Fix potentially writing one result of strtok beyond the end of alt_path.
authorVolker Lendecke <vlendec@samba.org>
Tue, 13 Jun 2006 19:40:28 +0000 (19:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:17:25 +0000 (11:17 -0500)
Found by Klocwork, ID 653.

Volker
(This used to be commit 4cb8cf221f986b15de3ac608b173310c14248533)

source3/smbd/msdfs.c

index 700aa2ae81c52b6df22328d2bf0df1367df0fde4..55a6850478fa69d2dd9c34b6052086f7eac88480 100644 (file)
@@ -203,7 +203,8 @@ static BOOL parse_symlink(TALLOC_CTX *ctx, char *buf, struct referral **preflist
        }
 
        /* parse out the alternate paths */
-       while(((alt_path[count] = strtok(NULL,",")) != NULL) && count<MAX_REFERRAL_COUNT) {
+       while((count<MAX_REFERRAL_COUNT) &&
+             ((alt_path[count] = strtok(NULL,",")) != NULL)) {
                count++;
        }