diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-10-02 19:24:58 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-10-02 19:24:58 +0200 |
commit | 3db384424bd7398ffbb7a355cab8f15f3add009f (patch) | |
tree | 4536961c62454aca3ac87ee88229e4d20c0d44fa /target/alphix.c | |
parent | d479dd1aab1c1cb907932c6595b0ef33523fc797 (diff) |
New upstream version 1.9.1+repackupstream/1.9.1+repack
Diffstat (limited to 'target/alphix.c')
-rw-r--r-- | target/alphix.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/target/alphix.c b/target/alphix.c index 68dfd48..6e5fc85 100644 --- a/target/alphix.c +++ b/target/alphix.c @@ -1,8 +1,10 @@ /* - * Argyll Color Correction System - * * Alphabetic index class. + */ + +/* + * Argyll Color Correction System * * Author: Graeme W. Gill * Date: 22/8/2005 @@ -63,6 +65,10 @@ static int fromanat(alphix *p, char *ax) { int cl; int i, k, rv = 0; + cl = strlen(ax); + if (cl > p->nd) /* String is too long to be our index */ + return -1; + if (p->nd > 10) { if ((tb = malloc((p->nd+1) * sizeof(char))) == NULL) return -1; /* Malloc error */ @@ -70,7 +76,6 @@ static int fromanat(alphix *p, char *ax) { tb = _tb; /* Pack the string out to the right number of digits with spaces. */ - cl = strlen(ax); for (v = tb; cl < p->nd; v++, cl++) *v = ' '; strcpy(v, ax); @@ -110,7 +115,7 @@ static char *find_start(alphix *p, char *ax) { if (*v == p->ds[i].seq[k]) break; /* Found */ } - if (k >= p->ds[i].n) /* Not found */ + if (k >= p->ds[i].n) /* Not found, so we are at the start */ break; } return v+1; @@ -444,6 +449,9 @@ int patch_location_order( /* We assume that the sequences are distinguishable ... */ v = find_start(rh, ax); + if (*v == '\000') /* Nothing looks like a alphix */ + return -1; + ri = rh->nix(rh, v); *v = '\000'; li = lh->nix(lh, ax); |