Index: head/lib/libcam/camlib.c =================================================================== --- head/lib/libcam/camlib.c +++ head/lib/libcam/camlib.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -132,6 +133,9 @@ * it so we don't hose the user's string. */ newpath = (char *)strdup(path); + if (newpath == NULL) + return (-1); + tmpstr = newpath; /* @@ -140,8 +144,9 @@ if (*tmpstr == '/') { tmpstr2 = tmpstr; tmpstr = strrchr(tmpstr2, '/'); - if ((tmpstr != NULL) && (*tmpstr != '\0')) - tmpstr++; + /* We know that tmpstr2 contains a '/', so strrchr can't fail */ + assert(tmpstr != NULL && *tmpstr != '\0'); + tmpstr++; } if (*tmpstr == '\0') {