tools: acrn-crashlog: remove unsafe apis in usercrash

Since strlen/vsnprintf/ato* api are not safe, so use strnlen instead of
strlen, use vasprintf instead of vsnprintf and use strtol instead of
atoi.

Tracked-On: #1254
Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Reviewed-by: Huang Yonghua <yonghua.huang@intel.com>
Reviewed-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
This commit is contained in:
xiaojin2
2018-09-29 09:30:48 +00:00
committed by wenlingz
parent 8f7fa50d5a
commit 6d076caaa6
6 changed files with 45 additions and 44 deletions

View File

@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
if (argc == 2) {
/* it's from shell cmd */
pid = atoi(argv[1]);
pid = (int)strtol(argv[1], NULL, 10);
crash_dump(pid, 0, STDOUT_FILENO);
} else {
print_usage();