+#define _POSIX_C_SOURCE 200809L
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* everything up to the first '-' is in the name */
while (*pstr) {
+ if (*pstr == '\'' || !isgraph(*pstr)) {
+ return 0;
+ }
if (*pstr == '-' && isdigit(*(pstr+1))) {
break;
}
pstr++;
}
while (*pstr && *pstr != '-') {
+ if (*pstr == '\'' || !isgraph(*pstr)) {
+ return 0;
+ }
if (ver) {
*ver++ = *pstr;
}
void zpm_sqlite_error(struct zpm *zpm) {
zpm->error = 1;
if (zpm->errmsg) free(zpm->errmsg);
- zpm->errmsg = zpm_strdup((char *)sqlite3_errmsg(zpm->db));
+ zpm->errmsg = strdup((const char *)sqlite3_errmsg(zpm->db));
}
char *zpm_findpkg(struct zpm *zpm, char *pkgstr) {
switch (sqlite3_step(stmt)) {
case SQLITE_ROW:
- zpm->pkgid = zpm_strdup((char *)sqlite3_column_text(stmt, 0));
+ zpm->pkgid = strdup((const char *)sqlite3_column_text(stmt, 0));
break;
case SQLITE_DONE:
/* not found */