Skip to content

Commit bcd9642

Browse files
committed
Avoid use-after-free in builtin unicode
Calculate length _before_ realloc, not after.
1 parent 50aca17 commit bcd9642

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/unicode_builtin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,13 @@ static inline bool unicode_builtin_encoding_convert(
372372
goto done;
373373
}
374374

375+
out_len = out_start - out;
376+
375377
if ((new_out = realloc(out, out_size)) == NULL) {
376378
ntlm_client_set_errmsg(ntlm, "out of memory");
377379
goto done;
378380
}
379381

380-
out_len = out_start - out;
381-
382382
out = new_out;
383383
out_start = new_out + out_len;
384384
out_end = out + out_size;

0 commit comments

Comments
 (0)