summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/delta.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-12-03 05:15:02 +0100
committerDan McGee <dan@archlinux.org>2008-12-03 05:15:02 +0100
commit61c6552862345cb155903cd1566f1cef5c527a94 (patch)
treea9c85c46a4ccd5cd8c001689541706e9287e4c50 /lib/libalpm/delta.c
parent9394f229a0328228e810b7d4588b24643b42df6a (diff)
parenta1f7c83dbf3bce492163362d2896e3a4176be616 (diff)
downloadpacman-61c6552862345cb155903cd1566f1cef5c527a94.tar.gz
pacman-61c6552862345cb155903cd1566f1cef5c527a94.tar.xz
Merge branch 'maint'
Conflicts: lib/libalpm/dload.c
Diffstat (limited to 'lib/libalpm/delta.c')
-rw-r--r--lib/libalpm/delta.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index 22d9beb4..8dce7e3b 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -22,6 +22,8 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
+#include <sys/types.h>
+#include <regex.h>
/* libalpm */
#include "delta.h"
@@ -257,6 +259,19 @@ pmdelta_t *_alpm_delta_parse(char *line)
{
pmdelta_t *delta;
char *tmp = line, *tmp2;
+ regex_t reg;
+
+ regcomp(&reg,
+ "^[^[:space:]]* [[:xdigit:]]{32}"
+ " [^[:space:]]* [[:xdigit:]]{32}"
+ " [^[:space:]]* [[:xdigit:]]{32} [[:digit:]]*$",
+ REG_EXTENDED | REG_NOSUB | REG_NEWLINE);
+ if(regexec(&reg, line, 0, 0, 0) != 0) {
+ /* delta line is invalid, return NULL */
+ regfree(&reg);
+ return(NULL);
+ }
+ regfree(&reg);
CALLOC(delta, 1, sizeof(pmdelta_t), RET_ERR(PM_ERR_MEMORY, NULL));