summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-01-15 02:15:33 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-01-15 02:15:33 +0000
commit32980739520919f0ce953867fbfef1c880bc666d (patch)
tree6ea241a70764536c47044aeb51ce040174429368
parentf58c2f6a0ee731d3d62f77af4e203d8b9f7a74e4 (diff)
parent359bd34e894e326c8e0ec46cfc19693e93f9a9e2 (diff)
Snap for 7083521 from 359bd34e894e326c8e0ec46cfc19693e93f9a9e2 to sc-d1-release
Change-Id: Ic40fc652cb984dc47a6b956967f20b4be1461230
-rw-r--r--OWNERS8
-rw-r--r--compress_plugin.c25
2 files changed, 16 insertions, 17 deletions
diff --git a/OWNERS b/OWNERS
index 8396392..b5d6d93 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,7 +1,3 @@
-# Default owners are top 3 active developers of the past 1 or 2 years
-# or people with more than 10 commits last year.
-# Please update this list if you find better owner candidates.
-smoreland@google.com
-vijaykv@google.com
-chh@google.com
cferris@google.com
+dvdli@google.com
+elaurent@google.com
diff --git a/compress_plugin.c b/compress_plugin.c
index d445ae9..7a5538d 100644
--- a/compress_plugin.c
+++ b/compress_plugin.c
@@ -1,6 +1,6 @@
/* compress_plugin.c
**
-** Copyright (c) 2019, The Linux Foundation. All rights reserved.
+** Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
@@ -333,10 +333,9 @@ static int compress_plug_open(unsigned int card, unsigned int device,
unsigned int flags, void **data, void *node)
{
struct compress_plug_data *plug_data;
- const char *err = NULL;
void *dl_hdl;
int rc = 0;
- char *so_name, *open_fn, token[80], *name;
+ char *so_name, *open_fn, token[80], *name, *token_saveptr;
plug_data = calloc(1, sizeof(*plug_data));
if (!plug_data) {
@@ -361,22 +360,26 @@ static int compress_plug_open(unsigned int card, unsigned int device,
}
sscanf(so_name, "lib%s", token);
- name = strtok(token, ".");
- open_fn = calloc(1, strlen(name) + strlen("_open") + 1);
+ token_saveptr = token;
+ name = strtok_r(token, ".", &token_saveptr);
+ if (!name) {
+ fprintf(stderr, "%s: invalid library name\n", __func__);
+ goto err_open_fn;
+ }
+ const size_t open_fn_size = strlen(name) + strlen("_open") + 1;
+ open_fn = calloc(1, open_fn_size);
if (!open_fn) {
rc = -ENOMEM;
goto err_open_fn;
}
- strncpy(open_fn, name, strlen(name) + 1);
- strcat(open_fn, "_open");
+ strlcpy(open_fn, name, open_fn_size);
+ strlcat(open_fn, "_open", open_fn_size);
plug_data->plugin_open_fn = dlsym(dl_hdl, open_fn);
- err = dlerror();
-
- if (err) {
+ if (!plug_data->plugin_open_fn) {
fprintf(stderr, "%s: dlsym to open fn failed, err = '%s'\n",
- __func__, err);
+ __func__, dlerror());
goto err_dlsym;
}