sdcard: mute false compiler alarm

Clang static analyzer worries that strcpy to a field may overwrites
other fields.  Use snprintf() instead.

Test: built without seeing the warning.

Change-Id: I75d8edf1353b5d052fd14a954362bd0632c258fa
This commit is contained in:
Ting-Yuan Huang 2017-08-29 15:48:30 -07:00
parent 2c3a2a8c5c
commit 1991ae9459
1 changed files with 3 additions and 1 deletions

View File

@ -249,7 +249,9 @@ static void run(const char* source_path, const char* label, uid_t uid,
global.root.uid = AID_ROOT;
global.root.under_android = false;
strcpy(global.source_path, source_path);
// Clang static analyzer think strcpy potentially overwrites other fields
// in global. Use snprintf() to mute the false warning.
snprintf(global.source_path, sizeof(global.source_path), "%s", source_path);
if (multi_user) {
global.root.perm = PERM_PRE_ROOT;