version 1.1, 2012/02/21 16:23:02
|
version 1.1.1.4, 2014/06/15 16:12:54
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 2010-2011 Todd C. Miller <Todd.Miller@courtesan.com> | * Copyright (c) 2010-2012 Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 17
|
Line 17
|
#include <config.h> |
#include <config.h> |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/param.h> |
|
|
|
#include <stdio.h> |
#include <stdio.h> |
#ifdef STDC_HEADERS |
#ifdef STDC_HEADERS |
Line 39
|
Line 38
|
#endif /* HAVE_STRINGS_H */ |
#endif /* HAVE_STRINGS_H */ |
|
|
#include "missing.h" |
#include "missing.h" |
|
#include "sudo_debug.h" |
|
#include "sudo_util.h" |
|
|
/* |
/* |
* Allocate storage for a name=value string and return it. |
* Allocate storage for a name=value string and return it. |
Line 49 fmt_string(const char *var, const char *val)
|
Line 50 fmt_string(const char *var, const char *val)
|
size_t var_len = strlen(var); |
size_t var_len = strlen(var); |
size_t val_len = strlen(val); |
size_t val_len = strlen(val); |
char *cp, *str; |
char *cp, *str; |
|
debug_decl(fmt_string, SUDO_DEBUG_UTIL) |
|
|
cp = str = malloc(var_len + 1 + val_len + 1); |
cp = str = malloc(var_len + 1 + val_len + 1); |
if (str != NULL) { |
if (str != NULL) { |
Line 60 fmt_string(const char *var, const char *val)
|
Line 62 fmt_string(const char *var, const char *val)
|
*cp = '\0'; |
*cp = '\0'; |
} |
} |
|
|
return str; | debug_return_str(str); |
} |
} |