Print this page
11924 infinite loop in mdb ::load
Reviewed by: John Levon <john.levon@joyent.com>
@@ -20,11 +20,11 @@
*/
/*
* 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>
#include <unistd.h>
#include <strings.h>
@@ -58,26 +58,27 @@
strbasename(name));
/*
* 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') {
+ if (q > p + 1) {
+
/* found digits to remove */
*p = '\0';
- continue;
}
-
+ }
+ if ((p = strrchr(buf, '.')) != NULL) {
if (strcmp(p, ".so") == 0) {
*p = '\0';
- break;
}
-
}
+ }
fullname = name;
name = buf;
}
if (!mdb_module_validate_name(name, &wformat))