Check that at most one argument which sets the payload is provided, so
the allocated payload is not overwritten and leaked.
Coverity ID: 54759
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99693
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
{
const char *arg = argv[i];
+ if (payload != NULL &&
+ (strstr (arg, "--payload=") == arg ||
+ strcmp (arg, "--stdin") == 0 ||
+ strcmp (arg, "--message-stdin") == 0 ||
+ strcmp (arg, "--random-size") == 0))
+ {
+ fprintf (stderr, "At most one of --payload, --stdin, --message-stdin "
+ "and --random-size may be specified\n\n");
+ usage (2);
+ }
+
if (strcmp (arg, "--system") == 0)
{
type = DBUS_BUS_SYSTEM;