Don't return overflow if no class buffer was specified.

diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c
index cc71780..fe89cf0 100644
--- a/dlls/advapi32/registry.c
+++ b/dlls/advapi32/registry.c
@@ -289,7 +289,7 @@
 
         if (ft) *ft = *(FILETIME *)&info->LastWriteTime;
 
-        if (len >= *name_len || (class_len && (cls_len >= *class_len)))
+        if (len >= *name_len || (class && class_len && (cls_len >= *class_len)))
             status = STATUS_BUFFER_OVERFLOW;
         else
         {
@@ -352,7 +352,7 @@
                                    info->ClassLength );
         if (ft) *ft = *(FILETIME *)&info->LastWriteTime;
 
-        if (len >= *name_len || (class_len && (cls_len >= *class_len)))
+        if (len >= *name_len || (class && class_len && (cls_len >= *class_len)))
             status = STATUS_BUFFER_OVERFLOW;
         else
         {