Increase the valid name of the iface to IFNAMSIZ

Define MAX_IFACE_LENGTH as IFNAMSIZ instead of 10, to
prevent netd from treating an interface name 'rmnet_sdio0'
as invalid.
Also fix an off-by-one error.

bug:5675718
Change-Id: I2b6ba823c89941031e5898b24dab388cd9c2dae8
diff --git a/SecondaryTableController.cpp b/SecondaryTableController.cpp
index 287bba5..2289259 100644
--- a/SecondaryTableController.cpp
+++ b/SecondaryTableController.cpp
@@ -55,7 +55,8 @@
 int SecondaryTableController::findTableNumber(const char *iface) {
     int i;
     for (i = 0; i < INTERFACES_TRACKED; i++) {
-        if (strncmp(iface, mInterfaceTable[i], MAX_IFACE_LENGTH) == 0) {
+        // compare through the final null, hence +1
+        if (strncmp(iface, mInterfaceTable[i], IFNAMSIZ + 1) == 0) {
             return i;
         }
     }
@@ -73,7 +74,9 @@
             cli->sendMsg(ResponseCode::OperationFailed, "Max number NATed", true);
             return -1;
         }
-        strncpy(mInterfaceTable[tableIndex], iface, MAX_IFACE_LENGTH);
+        strncpy(mInterfaceTable[tableIndex], iface, IFNAMSIZ);
+        // Ensure null termination even if truncation happened
+        mInterfaceTable[tableIndex][IFNAMSIZ] = 0;
     }
 
     return modifyRoute(cli, ADD, iface, dest, prefix, gateway, tableIndex);