diff options
Diffstat (limited to 'ext/pgsql/pgsql.c')
| -rw-r--r-- | ext/pgsql/pgsql.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index f82e1be7af..ffa6d23b0d 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2708,15 +2708,13 @@ static unsigned char * php_pgsql_unescape_bytea(unsigned char *strtext, size_t * case 3: if (isdigit(*sp)) /* state=4 */ { - unsigned int v,i; - unsigned char buf[4]; /* 000 + '\0' */ - + unsigned char *start, *end, buf[4]; /* 000 + '\0' */ + bp -= 3; - for (i = 0; i < 3; i++) - buf[i] = *((sp-2)+i); - buf[i] = '\0'; - sscanf(buf, "%03o", &v); - *bp = v; + memcpy(buf, sp-2, 3); + buf[3] = '\0'; + start = buf; + *bp = (unsigned char)strtoul(start, &end, 8); buflen -= 3; state = 0; } |
