Skip to content

Commit

Permalink
OS-7935 infinite loop in mdb ::load
Browse files Browse the repository at this point in the history
Reviewed by: John Levon <john.levon@joyent.com>
Approved by: John Levon <john.levon@joyent.com>
  • Loading branch information
markebrooks committed Nov 5, 2019
1 parent e5f16aa commit e77e89c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions usr/src/cmd/mdb/common/mdb/mdb_module_load.c
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e77e89c

Please sign in to comment.