From 11f18650e86054dcea6f8a69025a5e33d431b79d Mon Sep 17 00:00:00 2001 From: Sunmin Lee Date: Thu, 21 Sep 2017 15:13:45 +0900 Subject: [PATCH] Fix strtok_r bug In previous code the strtok and strtok_r were mixed in order to preserve each context. When fixed svace issues, this intention was not considered. Fix the bug about it. Change-Id: I76d838370fa5d3d0ebcf16b0e33e3055f5b869f8 Signed-off-by: Sunmin Lee --- ss_engine/SS_UPI.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ss_engine/SS_UPI.c b/ss_engine/SS_UPI.c index b974c18..be6bbcd 100755 --- a/ss_engine/SS_UPI.c +++ b/ss_engine/SS_UPI.c @@ -1158,7 +1158,8 @@ int SS_FSSetAttributes(ua_dataSS_t * ua_dataSS) } while (pline) { - pfilePath = strtok_r(pline, "\"", &psaveptr); + char *saveptr_pline; + pfilePath = strtok_r(pline, "\"", &saveptr_pline); if (pfilePath && strcmp(pfilePath, SS_FWSLASH) == 0) { LOGE("\n skip root: it is RO"); @@ -1166,9 +1167,9 @@ int SS_FSSetAttributes(ua_dataSS_t * ua_dataSS) continue; } - pfiletype = strtok_r(NULL, SS_TOKEN_SPACE, &psaveptr); - attributSize = strtok_r(NULL, SS_TOKEN_SPACE, &psaveptr); - pattribs = strtok_r(NULL, SS_TOKEN_NEWLINE, &psaveptr); + pfiletype = strtok_r(NULL, SS_TOKEN_SPACE, &saveptr_pline); + attributSize = strtok_r(NULL, SS_TOKEN_SPACE, &saveptr_pline); + pattribs = strtok_r(NULL, SS_TOKEN_NEWLINE, &saveptr_pline); LOG("\nSS_FSSetAttributes [%s][%s][%s]", pfiletype, attributSize, pattribs); if (pattribs && pfilePath && pfiletype) { ulAttribSize = strlen(pattribs); -- 2.7.4