X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fquotearg.c;h=90134740ebe4355117c6c15b4426b19f92247ec2;hb=7ef6c64e210ac0979d7e8ac69bc5b5208c2405ab;hp=7fb866d5c600f13d847956d319cbb24ce86fbc16;hpb=0dbbe3f55352241d290403577dfebed802d6fd9a;p=gnulib.git diff --git a/lib/quotearg.c b/lib/quotearg.c index 7fb866d5c..90134740e 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -1,6 +1,6 @@ /* quotearg.c - quote arguments for output - Copyright (C) 1998-2002, 2004-2012 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004-2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -348,7 +348,12 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, if (backslash_escapes && quote_string_len - && i + quote_string_len <= argsize + && (i + quote_string_len + <= (argsize == SIZE_MAX && 1 < quote_string_len + /* Use strlen only if we must: when argsize is SIZE_MAX, + and when the quote string is more than 1 byte long. + If we do call strlen, save the result. */ + ? (argsize = strlen (arg)) : argsize)) && memcmp (arg + i, quote_string, quote_string_len) == 0) { if (elide_outer_quotes) @@ -621,7 +626,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, if (! ((backslash_escapes || elide_outer_quotes) && quote_these_too - && quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))) + && quote_these_too[c / INT_BITS] >> (c % INT_BITS) & 1) && !is_right_quote) goto store_c;