summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/util/nterr.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/libcli/util/nterr.c b/source4/libcli/util/nterr.c
index 99b5191273..f2b15f03e8 100644
--- a/source4/libcli/util/nterr.c
+++ b/source4/libcli/util/nterr.c
@@ -897,22 +897,23 @@ const char *get_friendly_nt_error_msg(NTSTATUS nt_code)
Returns an NT_STATUS constant as a string for inclusion in autogen C code.
*****************************************************************************/
-const char *get_nt_error_c_code(NTSTATUS nt_code)
+const char *get_nt_error_c_code(TALLOC_CTX *mem_ctx, NTSTATUS nt_code)
{
- static char out[40];
+ char *result;
int idx = 0;
while (nt_errs[idx].nt_errstr != NULL) {
if (NT_STATUS_V(nt_errs[idx].nt_errcode) ==
NT_STATUS_V(nt_code)) {
- return nt_errs[idx].nt_errstr;
+ result = talloc_strdup(mem_ctx, nt_errs[idx].nt_errstr);
+ return result;
}
idx++;
}
- slprintf(out, sizeof(out), "NT_STATUS(0x%08x)", NT_STATUS_V(nt_code));
-
- return out;
+ result = talloc_asprintf(mem_ctx, "NT_STATUS(0x%08x)",
+ NT_STATUS_V(nt_code));
+ return result;
}
/*****************************************************************************