qapi: fix input visitor bugs
Remove dead code. Reset errno to 0 before each strtoull call, as the man page requires. Reported-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
		
							parent
							
								
									b4acfbcd95
								
							
						
					
					
						commit
						c210ee95f2
					
				@ -48,11 +48,10 @@ static void parse_str(StringInputVisitor *siv, Error **errp)
 | 
				
			|||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    errno = 0;
 | 
					 | 
				
			||||||
    do {
 | 
					    do {
 | 
				
			||||||
 | 
					        errno = 0;
 | 
				
			||||||
        start = strtoll(str, &endptr, 0);
 | 
					        start = strtoll(str, &endptr, 0);
 | 
				
			||||||
        if (errno == 0 && endptr > str && INT64_MIN <= start &&
 | 
					        if (errno == 0 && endptr > str) {
 | 
				
			||||||
            start <= INT64_MAX) {
 | 
					 | 
				
			||||||
            if (*endptr == '\0') {
 | 
					            if (*endptr == '\0') {
 | 
				
			||||||
                cur = g_malloc0(sizeof(*cur));
 | 
					                cur = g_malloc0(sizeof(*cur));
 | 
				
			||||||
                cur->begin = start;
 | 
					                cur->begin = start;
 | 
				
			||||||
@ -63,9 +62,9 @@ static void parse_str(StringInputVisitor *siv, Error **errp)
 | 
				
			|||||||
                str = NULL;
 | 
					                str = NULL;
 | 
				
			||||||
            } else if (*endptr == '-') {
 | 
					            } else if (*endptr == '-') {
 | 
				
			||||||
                str = endptr + 1;
 | 
					                str = endptr + 1;
 | 
				
			||||||
 | 
					                errno = 0;
 | 
				
			||||||
                end = strtoll(str, &endptr, 0);
 | 
					                end = strtoll(str, &endptr, 0);
 | 
				
			||||||
                if (errno == 0 && endptr > str &&
 | 
					                if (errno == 0 && endptr > str && start <= end &&
 | 
				
			||||||
                    INT64_MIN <= end && end <= INT64_MAX && start <= end &&
 | 
					 | 
				
			||||||
                    (start > INT64_MAX - 65536 ||
 | 
					                    (start > INT64_MAX - 65536 ||
 | 
				
			||||||
                     end < start + 65536)) {
 | 
					                     end < start + 65536)) {
 | 
				
			||||||
                    if (*endptr == '\0') {
 | 
					                    if (*endptr == '\0') {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user