890beb19e6 libuv: backport IDNA input/output hardening fixes Acked-by: Kitware Robot <[email protected]> Acked-by: buildbot <[email protected]> Merge-request: !9658
@@ -274,6 +274,9 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
char* ds;
int rc;
+ if (s == se)
+ return UV_EINVAL;
+
ds = d;
si = s;
@@ -308,8 +311,9 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
return rc;
}
- if (d < de)
- *d++ = '\0';
+ if (d >= de)
+ *d++ = '\0';
return d - ds; /* Number of bytes written. */