pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/wrapper Protect against underflow in the argument b...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/778b288a2510
branches:  trunk
changeset: 480942:778b288a2510
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Sep 22 08:35:01 2004 +0000

description:
Protect against underflow in the argument buffer in the inner while loop,
noted in PR pkg/27014.

diffstat:

 mk/wrapper/logic |  18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)

diffs (53 lines):

diff -r a1f281a4709f -r 778b288a2510 mk/wrapper/logic
--- a/mk/wrapper/logic  Wed Sep 22 08:09:14 2004 +0000
+++ b/mk/wrapper/logic  Wed Sep 22 08:35:01 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: logic,v 1.1 2004/09/21 15:01:41 jlam Exp $
+# $NetBSD: logic,v 1.2 2004/09/22 08:35:01 jlam Exp $
 #
 # Copyright (c) 2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -43,6 +43,10 @@
        #
        argok=no
        while $test "$argok" = "no"; do
+               if queue_is_empty argbuf; then
+                       argok=yes
+                       continue
+               fi
                pop_queue argbuf arg
                $debug_log $wrapperlog "    (logic) pop:  $arg"
                #
@@ -94,10 +98,6 @@
                # Same for -Wl,-L, -Wl,-rpath and -Wl,-rpath-link.
                ######################################################
                -Wl,-[LR])
-                       if queue_is_empty argbuf; then
-                               argok=yes
-                               continue
-                       fi
                        pop_queue argbuf nextarg
                        $debug_log $wrapperlog "    (logic) pop:  $nextarg"
                        shquote "${nextarg#-Wl,}"; nextarg="$shquoted"
@@ -105,10 +105,6 @@
                        prepend_queue argbuf "$arg$nextarg"
                        ;;
                -Wl,-rpath|-Wl,-rpath-link|-Wl,--rpath)
-                       if queue_is_empty argbuf; then
-                               argok=yes
-                               continue
-                       fi
                        pop_queue argbuf nextarg
                        $debug_log $wrapperlog "    (logic) pop:  $nextarg"
                        shquote "${nextarg#-Wl,}"; nextarg="$shquoted"
@@ -129,10 +125,6 @@
                # Remove consecutive, repeated library options.
                ######################################################
                -l*)
-                       if queue_is_empty argbuf; then
-                               argok=yes
-                               continue
-                       fi
                        head_queue argbuf nextarg
                        while $test "$nextarg" = "$arg"; do
                                pop_queue argbuf nextarg



Home | Main Index | Thread Index | Old Index