Fri Aug 13 18:57:38 2010 UTC ()
Don't allow a prefix or other directory ending in /. Adresses PR 43754.


(joerg)
diff -r1.157 -r1.158 pkgsrc/bootstrap/bootstrap

cvs diff -r1.157 -r1.158 pkgsrc/bootstrap/bootstrap (expand / switch to unified diff)

--- pkgsrc/bootstrap/bootstrap 2010/03/19 14:11:11 1.157
+++ pkgsrc/bootstrap/bootstrap 2010/08/13 18:57:36 1.158
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1#! /bin/sh 1#! /bin/sh
2 2
3# $NetBSD: bootstrap,v 1.157 2010/03/19 14:11:11 seanb Exp $ 3# $NetBSD: bootstrap,v 1.158 2010/08/13 18:57:36 joerg Exp $
4# 4#
5# 5#
6# Copyright (c) 2001-2002 Alistair G. Crooks. All rights reserved. 6# Copyright (c) 2001-2002 Alistair G. Crooks. All rights reserved.
7# 7#
8# Redistribution and use in source and binary forms, with or without 8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions 9# modification, are permitted provided that the following conditions
10# are met: 10# are met:
11# 1. Redistributions of source code must retain the above copyright 11# 1. Redistributions of source code must retain the above copyright
12# notice, this list of conditions and the following disclaimer. 12# notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright 13# 2. Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in the 14# notice, this list of conditions and the following disclaimer in the
15# documentation and/or other materials provided with the distribution. 15# documentation and/or other materials provided with the distribution.
16# 3. All advertising materials mentioning features or use of this software 16# 3. All advertising materials mentioning features or use of this software
@@ -306,26 +306,27 @@ copy_src() @@ -306,26 +306,27 @@ copy_src()
306 $cpprog -r $_src/* $wrkdir/$_dst 306 $cpprog -r $_src/* $wrkdir/$_dst
307} 307}
308 308
309get_optarg() 309get_optarg()
310{ 310{
311 expr "x$1" : "x[^=]*=\\(.*\\)" 311 expr "x$1" : "x[^=]*=\\(.*\\)"
312} 312}
313 313
314checkarg_sane_absolute_path() { 314checkarg_sane_absolute_path() {
315 case "$1" in 315 case "$1" in
316 "") ;; # the default value will be used. 316 "") ;; # the default value will be used.
317 *[!-A-Za-z0-9_./]*) 317 *[!-A-Za-z0-9_./]*)
318 die "ERROR: Invalid characters in path $1 (from $2)." ;; 318 die "ERROR: Invalid characters in path $1 (from $2)." ;;
 319 */) die "ERROR: The argument to $2 must not end in /." ;;
319 /*) ;; 320 /*) ;;
320 *) die "ERROR: The argument to $2 must be an absolute path." ;; 321 *) die "ERROR: The argument to $2 must be an absolute path." ;;
321 esac 322 esac
322} 323}
323 324
324checkarg_sane_relative_path() { 325checkarg_sane_relative_path() {
325 case "$1" in 326 case "$1" in
326 "") ;; # the default value will be used. 327 "") ;; # the default value will be used.
327 *[!-A-Za-z0-9_./]*) 328 *[!-A-Za-z0-9_./]*)
328 die "ERROR: Invalid characters in path $1 (from $2)." ;; 329 die "ERROR: Invalid characters in path $1 (from $2)." ;;
329 /*) die "ERROR: The argument to $2 must be a relative path." ;; 330 /*) die "ERROR: The argument to $2 must be a relative path." ;;
330 *) ;; 331 *) ;;
331 esac 332 esac