From e9925f5acb4401588e23ea8a27c3e318f71b5cf8 Mon Sep 17 00:00:00 2001 From: Bryse Flowers Date: Thu, 11 Feb 2016 12:20:37 -0800 Subject: netd: Validate incoming upstream interface before adding Add isIfaceName check to addUpstreamInterface. Change-Id: Iacb5cb1ca6476765e5350b1cf3d822f4fcda32b8 CRs-Fixed: 959631 --- server/TetherController.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/TetherController.cpp b/server/TetherController.cpp index f6287c8..c4d6b83 100644 --- a/server/TetherController.cpp +++ b/server/TetherController.cpp @@ -482,9 +482,10 @@ int TetherController::addUpstreamInterface(char *iface) ALOGD("addUpstreamInterface(%s)\n", iface); - if (!iface) { - ALOGE("addUpstreamInterface: received null interface"); - return 0; + if (!isIfaceName(iface)) { + ALOGE("addUpstreamInterface: received invalid interface"); + errno = ENOENT; + return -1; } for (it = mUpstreamInterfaces->begin(); it != mUpstreamInterfaces->end(); ++it) { ALOGD("."); -- cgit v1.1