summaryrefslogtreecommitdiff
path: root/legacy/embryo/src/lib/embryo_str.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2010-08-28 14:45:04 +0000
committerCarsten Haitzler <raster@rasterman.com>2010-08-28 14:45:04 +0000
commit393c3fda9fe7a77f88d3af2dc1f90eebad728d6e (patch)
tree8107f741432b4a99051074e3222cf85d86c903ba /legacy/embryo/src/lib/embryo_str.c
parentacac588d58cdc7e3ad78c76a1fddffe12ed0b869 (diff)
fix possible null str deref.
SVN revision: 51698
Diffstat (limited to '')
-rw-r--r--legacy/embryo/src/lib/embryo_str.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/legacy/embryo/src/lib/embryo_str.c b/legacy/embryo/src/lib/embryo_str.c
index cd3b942010..653ff50bff 100644
--- a/legacy/embryo/src/lib/embryo_str.c
+++ b/legacy/embryo/src/lib/embryo_str.c
@@ -439,6 +439,7 @@ _embryo_str_strchr(Embryo_Program *ep, Embryo_Cell *params)
439 if (params[0] != (2 * sizeof(Embryo_Cell))) return 0; 439 if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
440 STRGET(ep, s1, params[1]); 440 STRGET(ep, s1, params[1]);
441 STRGET(ep, s2, params[2]); 441 STRGET(ep, s2, params[2]);
442 if ((!s1) || (!s2)) return -1;
442 p = strchr(s1, s2[0]); 443 p = strchr(s1, s2[0]);
443 if (!p) return -1; 444 if (!p) return -1;
444 return (Embryo_Cell)(p - s1); 445 return (Embryo_Cell)(p - s1);
@@ -454,6 +455,7 @@ _embryo_str_strrchr(Embryo_Program *ep, Embryo_Cell *params)
454 if (params[0] != (2 * sizeof(Embryo_Cell))) return 0; 455 if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
455 STRGET(ep, s1, params[1]); 456 STRGET(ep, s1, params[1]);
456 STRGET(ep, s2, params[2]); 457 STRGET(ep, s2, params[2]);
458 if ((!s1) || (!s2)) return -1;
457 p = strrchr(s1, s2[0]); 459 p = strrchr(s1, s2[0]);
458 if (!p) return -1; 460 if (!p) return -1;
459 return (Embryo_Cell)(p - s1); 461 return (Embryo_Cell)(p - s1);