diff options
author | Dan McGee <dan@archlinux.org> | 2008-12-02 22:15:02 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-12-02 22:15:02 -0600 |
commit | 61c6552862345cb155903cd1566f1cef5c527a94 (patch) | |
tree | a9c85c46a4ccd5cd8c001689541706e9287e4c50 /lib/libalpm/delta.c | |
parent | 9394f229a0328228e810b7d4588b24643b42df6a (diff) | |
parent | a1f7c83dbf3bce492163362d2896e3a4176be616 (diff) |
Merge branch 'maint'
Conflicts:
lib/libalpm/dload.c
Diffstat (limited to 'lib/libalpm/delta.c')
-rw-r--r-- | lib/libalpm/delta.c | 15 |
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(®, + "^[^[:space:]]* [[:xdigit:]]{32}" + " [^[:space:]]* [[:xdigit:]]{32}" + " [^[:space:]]* [[:xdigit:]]{32} [[:digit:]]*$", + REG_EXTENDED | REG_NOSUB | REG_NEWLINE); + if(regexec(®, line, 0, 0, 0) != 0) { + /* delta line is invalid, return NULL */ + regfree(®); + return(NULL); + } + regfree(®); CALLOC(delta, 1, sizeof(pmdelta_t), RET_ERR(PM_ERR_MEMORY, NULL)); |