Print this page
11924 infinite loop in mdb ::load
Reviewed by: John Levon <john.levon@joyent.com>

*** 20,30 **** */ /* * 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. */ #include <sys/param.h> #include <unistd.h> #include <strings.h> --- 20,30 ---- */ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. ! * Copyright 2019 Joyent, Inc. */ #include <sys/param.h> #include <unistd.h> #include <strings.h>
*** 58,83 **** strbasename(name)); /* * Remove any .so(.[0-9]+)? suffix */ ! while ((p = strrchr(buf, '.')) != NULL) { for (q = p + 1; isdigit(*q); q++) ; if (*q == '\0') { /* found digits to remove */ *p = '\0'; - continue; } ! if (strcmp(p, ".so") == 0) { *p = '\0'; - break; } - } fullname = name; name = buf; } if (!mdb_module_validate_name(name, &wformat)) --- 58,84 ---- strbasename(name)); /* * Remove any .so(.[0-9]+)? suffix */ ! 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'; } ! } ! if ((p = strrchr(buf, '.')) != NULL) { if (strcmp(p, ".so") == 0) { *p = '\0'; } } + } fullname = name; name = buf; } if (!mdb_module_validate_name(name, &wformat))