diff options
| author | Michael Forney <mforney@mforney.org> | 2016-06-04 23:37:03 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2016-06-04 23:37:03 -0700 |
| commit | 3c035f1cb1bb3d2d0527c496754690d7414d113d (patch) | |
| tree | c6315345af93ce0f150c7ece9652738fb695e916 /core | |
| parent | b1e2f40aacabd03a978af5a70c0105d34dc2ec28 (diff) | |
sbase: Fix some od bugs
Diffstat (limited to 'core')
| -rw-r--r-- | core/sbase/patch/0007-od-Add-some-missing-type-flags.patch | 67 | ||||
| -rw-r--r-- | core/sbase/patch/0008-od-Don-t-advance-past-end-of-type-string.patch | 43 |
2 files changed, 110 insertions, 0 deletions
diff --git a/core/sbase/patch/0007-od-Add-some-missing-type-flags.patch b/core/sbase/patch/0007-od-Add-some-missing-type-flags.patch new file mode 100644 index 00000000..68c5a8ea --- /dev/null +++ b/core/sbase/patch/0007-od-Add-some-missing-type-flags.patch @@ -0,0 +1,67 @@ +From 8f5bc3b12e214eb94e607202e26d8377ca30519c Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sat, 4 Jun 2016 23:26:08 -0700 +Subject: [PATCH] od: Add some missing type flags + +--- + od.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/od.c b/od.c +index 5a625b6..b88e514 100644 +--- a/od.c ++++ b/od.c +@@ -197,6 +197,18 @@ main(int argc, char *argv[]) + usage(); + addr_format = s[0]; + break; ++ case 'b': ++ t = emalloc(sizeof(struct type)); ++ t->format = 'o'; ++ t->len = 1; ++ TAILQ_INSERT_TAIL(&head, t, entry); ++ break; ++ case 'd': ++ t = emalloc(sizeof(struct type)); ++ t->format = 'u'; ++ t->len = 2; ++ TAILQ_INSERT_TAIL(&head, t, entry); ++ break; + case 'E': + case 'e': + big_endian = (ARGC() == 'E'); +@@ -209,6 +221,18 @@ main(int argc, char *argv[]) + if ((max = parseoffset(EARGF(usage()))) < 0) + usage(); + break; ++ case 'o': ++ t = emalloc(sizeof(struct type)); ++ t->format = 'o'; ++ t->len = 2; ++ TAILQ_INSERT_TAIL(&head, t, entry); ++ break; ++ case 's': ++ t = emalloc(sizeof(struct type)); ++ t->format = 'd'; ++ t->len = 2; ++ TAILQ_INSERT_TAIL(&head, t, entry); ++ break; + case 't': + s = EARGF(usage()); + for (; *s; s++) { +@@ -256,6 +280,12 @@ main(int argc, char *argv[]) + case 'v': + /* always set - use uniq(1) to handle duplicate lines */ + break; ++ case 'x': ++ t = emalloc(sizeof(struct type)); ++ t->format = 'x'; ++ t->len = 2; ++ TAILQ_INSERT_TAIL(&head, t, entry); ++ break; + default: + usage(); + } ARGEND +-- +2.8.1 + diff --git a/core/sbase/patch/0008-od-Don-t-advance-past-end-of-type-string.patch b/core/sbase/patch/0008-od-Don-t-advance-past-end-of-type-string.patch new file mode 100644 index 00000000..0c53fe5f --- /dev/null +++ b/core/sbase/patch/0008-od-Don-t-advance-past-end-of-type-string.patch @@ -0,0 +1,43 @@ +From 489fd212950383b7c9375581f04095843ef67e83 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sat, 4 Jun 2016 23:26:43 -0700 +Subject: [PATCH] od: Don't advance past end of type string + +Also, use sizeof(int) when no length is specified. +--- + od.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/od.c b/od.c +index b88e514..529f636 100644 +--- a/od.c ++++ b/od.c +@@ -251,9 +251,9 @@ main(int argc, char *argv[]) + t->format = *s; + /* todo: allow multiple digits */ + if (*(s+1) > '0' && *(s+1) <= '9') { +- t->len = *(++s) - '0'; ++ t->len = *(s+1) - '0'; + } else { +- switch (*(++s)) { ++ switch (*(s+1)) { + case 'C': + t->len = sizeof(char); + break; +@@ -267,9 +267,12 @@ main(int argc, char *argv[]) + t->len = sizeof(long); + break; + default: +- t->len = 4; ++ t->len = sizeof(int); ++ goto insert; + } + } ++ ++s; ++ insert: + TAILQ_INSERT_TAIL(&head, t, entry); + break; + default: +-- +2.8.1 + |
