Support reading output from IptablesRestoreController.

Add the ability to IptablesRestoreController to return the output
of a command. This is useful to run commands that list chains or
return counters through the ip[6]tables-restore.

Also enable unsigned-integer-overflow sanitization the unit tests
because their behaviour should be representative of actual code.
Having address sanitization enabled would have saved a fair
amount of time debugging an on-device abort() that did not affect
the tests.

Test: new unit test passes
Bug: 32323979
Change-Id: I70726ebbade0cb792aba38787c57378df177f2d8
diff --git a/server/IptablesBaseTest.h b/server/IptablesBaseTest.h
index d175c5b..5843361 100644
--- a/server/IptablesBaseTest.h
+++ b/server/IptablesBaseTest.h
@@ -30,6 +30,8 @@
     static int fake_android_fork_execvp(int argc, char* argv[], int *status, bool, bool);
     static int fakeExecIptables(IptablesTarget target, ...);
     static int fakeExecIptablesRestore(IptablesTarget target, const std::string& commands);
+    static int fakeExecIptablesRestoreWithOutput(IptablesTarget target, const std::string& commands,
+                                                 std::string *output);
     static FILE *fake_popen(const char *cmd, const char *type);
     void expectIptablesCommands(const std::vector<std::string>& expectedCmds);
     void expectIptablesCommands(const ExpectedIptablesCommands& expectedCmds);
@@ -41,5 +43,6 @@
     static std::vector<std::string> sCmds;
     static ExpectedIptablesCommands sRestoreCmds;
     static std::deque<std::string> sPopenContents;
+    static std::deque<std::string> sIptablesRestoreOutput;
     int expectIptablesCommand(IptablesTarget target, int pos, const std::string& cmd);
 };