diff options
| author | Mark Brooks <mark.brooks@joyent.com> | 2019-11-05 11:30:38 +0000 |
|---|---|---|
| committer | Mark Brooks <mark.brooks@joyent.com> | 2019-11-05 12:17:38 +0000 |
| commit | e77e89c1413d1b43560c28ccc3aaeb3aa8f2fbe5 (patch) | |
| tree | ced8acd73607aca459845de2476cd2514fb3c700 | |
| parent | e5f16aa846188e1940efcda89b77269a6fb3159b (diff) | |
| download | illumos-joyent-e77e89c1413d1b43560c28ccc3aaeb3aa8f2fbe5.tar.gz | |
OS-7935 infinite loop in mdb ::load
Reviewed by: John Levon <john.levon@joyent.com>
Approved by: John Levon <john.levon@joyent.com>
| -rw-r--r-- | usr/src/cmd/mdb/common/mdb/mdb_module_load.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_module_load.c b/usr/src/cmd/mdb/common/mdb/mdb_module_load.c index 811af3dd47..141aa3a5cd 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_module_load.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_module_load.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. - * Copyright (c) 2012 Joyent, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. */ #include <sys/param.h> @@ -60,21 +60,22 @@ mdb_module_load(const char *name, int mode) /* * Remove any .so(.[0-9]+)? suffix */ - while ((p = strrchr(buf, '.')) != NULL) { + if ((p = strrchr(buf, '.')) != NULL) { for (q = p + 1; isdigit(*q); q++) ; if (*q == '\0') { - /* found digits to remove */ - *p = '\0'; - continue; - } + if (q > p + 1) { - if (strcmp(p, ".so") == 0) { - *p = '\0'; - break; + /* found digits to remove */ + *p = '\0'; + } + } + if ((p = strrchr(buf, '.')) != NULL) { + if (strcmp(p, ".so") == 0) { + *p = '\0'; + } } - } fullname = name; name = buf; |
