# HG changeset patch # User clanger # Date 1521793619 -3600 # Node ID 6e2d71029781b16a5753577fa1b27d65bf9fda77 # Parent c84772a698c893daa344067d7697ad8be35a235d 8199924: Solaris: Correctly enqueue null arguments of attach operations Reviewed-by: dcubed, dholmes diff -r c84772a698c8 -r 6e2d71029781 src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c --- a/src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c Thu Mar 22 23:49:48 2018 +0000 +++ b/src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c Fri Mar 23 09:26:59 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -231,7 +231,7 @@ int table_size = sizeof(error_messages) / sizeof(error_messages[0]); int i; - for (i=0; iGetArrayLength(env, args); - for (i=0; iGetObjectArrayElement(env, args, i); if (obj != NULL) { cstr = JNU_GetStringPlatformChars(env, obj, &isCopy); @@ -314,6 +314,15 @@ return -1; } } + } else { + char* newbuf = (char*)realloc(buf, size + 1); + if (newbuf == NULL) { + free(buf); + JNU_ThrowOutOfMemoryError(env, "realloc failed"); + return -1; + } + buf = newbuf; + buf[size++] = 0; } if ((*env)->ExceptionOccurred(env)) { free(buf);