src/share/vm/jfr/recorder/repository/jfrRepository.cpp

changeset 9880
3549c2f110d2
parent 9858
b985cbb00e68
child 9947
db357034b763
     1.1 --- a/src/share/vm/jfr/recorder/repository/jfrRepository.cpp	Tue Jan 15 21:17:35 2019 +0100
     1.2 +++ b/src/share/vm/jfr/recorder/repository/jfrRepository.cpp	Thu Feb 14 15:17:03 2019 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -209,8 +209,7 @@
    1.11    if (entry_name == NULL) {
    1.12      return NULL;
    1.13    }
    1.14 -  strncpy(entry_name, entry, entry_len);
    1.15 -  entry_name[entry_len] = '\0';
    1.16 +  strncpy(entry_name, entry, entry_len + 1);
    1.17    const char* const fully_qualified_path_entry = fully_qualified(entry_name);
    1.18    if (NULL == fully_qualified_path_entry) {
    1.19      return NULL;
    1.20 @@ -332,8 +331,7 @@
    1.21      if (NULL == emergency_dump_path) {
    1.22        return NULL;
    1.23      }
    1.24 -    strncpy(emergency_dump_path, buffer, emergency_filename_length);
    1.25 -    emergency_dump_path[emergency_filename_length] = '\0';
    1.26 +    strncpy(emergency_dump_path, buffer, emergency_filename_length + 1);
    1.27    }
    1.28    return emergency_dump_path;
    1.29  }
    1.30 @@ -407,8 +405,7 @@
    1.31    if (_path == NULL) {
    1.32      return false;
    1.33    }
    1.34 -  strncpy(_path, path, path_len);
    1.35 -  _path[path_len] = '\0';
    1.36 +  strncpy(_path, path, path_len + 1);
    1.37    return true;
    1.38  }
    1.39  

mercurial