File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -969,7 +969,7 @@ PHP_FUNCTION(unpack)
969
969
zend_long len = (inputlen - inputpos ) * 2 ; /* Remaining */
970
970
int nibbleshift = (type == 'h' ) ? 0 : 4 ;
971
971
int first = 1 ;
972
- char * buf ;
972
+ zend_string * buf ;
973
973
zend_long ipos , opos ;
974
974
975
975
/* If size was given take minimum of len and size */
@@ -981,7 +981,7 @@ PHP_FUNCTION(unpack)
981
981
len -= argb % 2 ;
982
982
}
983
983
984
- buf = emalloc (len + 1 );
984
+ buf = zend_string_alloc (len , 0 );
985
985
986
986
for (ipos = opos = 0 ; opos < len ; opos ++ ) {
987
987
char cc = (input [inputpos + ipos ] >> nibbleshift ) & 0xf ;
@@ -992,7 +992,7 @@ PHP_FUNCTION(unpack)
992
992
cc += 'a' - 10 ;
993
993
}
994
994
995
- buf [opos ] = cc ;
995
+ ZSTR_VAL ( buf ) [opos ] = cc ;
996
996
nibbleshift = (nibbleshift + 4 ) & 7 ;
997
997
998
998
if (first -- == 0 ) {
@@ -1001,9 +1001,8 @@ PHP_FUNCTION(unpack)
1001
1001
}
1002
1002
}
1003
1003
1004
- buf [len ] = '\0' ;
1005
- add_assoc_stringl (return_value , n , buf , len );
1006
- efree (buf );
1004
+ ZSTR_VAL (buf )[len ] = '\0' ;
1005
+ add_assoc_str (return_value , n , buf );
1007
1006
break ;
1008
1007
}
1009
1008
You can’t perform that action at this time.
0 commit comments