瀏覽代碼

libobs/util: Fix potential crash

sunjingzhao 5 年之前
父節點
當前提交
05826491af
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      libobs/util/dstr.c

+ 2 - 2
libobs/util/dstr.c

@@ -218,7 +218,7 @@ char *strdepad(char *str)
 	while (is_padding(*temp))
 		++temp;
 
-	len = strlen(str);
+	len = strlen(temp);
 	if (temp != str)
 		memmove(str, temp, len + 1);
 
@@ -247,7 +247,7 @@ wchar_t *wcsdepad(wchar_t *str)
 	while (*temp == ' ' || *temp == '\t')
 		++temp;
 
-	len = wcslen(str);
+	len = wcslen(temp);
 	if (temp != str)
 		memmove(str, temp, (len + 1) * sizeof(wchar_t));