/*
- * Copyright (c) 2011-2013 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 2011-2013, 2015-2016 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
#define fill(a, b) fill_txt(a, b, 0)
-/* realloc() to size + COMMANDARGINC to make room for command args */
-#define COMMANDARGINC 64
-
#define LEXTRACE(msg) do { \
if (trace_print != NULL) \
(*trace_print)(msg); \
new_len = arg_len + len + addspace;
if (new_len >= arg_size) {
- /* Allocate more space than we need for subsequent args */
- while (new_len >= (arg_size += COMMANDARGINC))
- continue;
+ /* Allocate in increments of 128 bytes to avoid excessive realloc(). */
+ arg_size = (new_len + 127) & ~127;
p = realloc(sudoerslval.command.args, arg_size);
if (p == NULL) {