xbps_get_pkg_{name,version}: check for strrchr() returning NULL.
--HG-- extra : convert_revision : 4d63c1834f7b3c3b1a0395a7434095e9fc341885
This commit is contained in:
parent
952a8f9266
commit
6f8647f5c8
|
@ -117,7 +117,9 @@ xbps_get_pkg_version(const char *pkg)
|
|||
|
||||
/* Get the required version */
|
||||
tmp = strrchr(pkg, '-');
|
||||
assert(tmp != NULL);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
|
||||
return tmp + 1; /* skip first '-' */
|
||||
}
|
||||
|
||||
|
@ -132,7 +134,9 @@ xbps_get_pkg_name(const char *pkg)
|
|||
|
||||
/* Get package name */
|
||||
tmp = strrchr(pkg, '-');
|
||||
assert(tmp != NULL);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
|
||||
len = strlen(pkg) - strlen(tmp) + 1;
|
||||
|
||||
pkgname = malloc(len);
|
||||
|
|
Loading…
Reference in New Issue