git.samba.org
/
abartlet
/
lorikeet-heimdal.git
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d8db9d5
)
Check allocation error and free on error [CID-114]
author
Love Hornquist Astrand
<lha@h5l.org>
Thu, 30 Jul 2009 08:32:33 +0000
(10:32 +0200)
committer
Love Hornquist Astrand
<lha@h5l.org>
Thu, 30 Jul 2009 08:32:33 +0000
(10:32 +0200)
appl/ftp/ftp/security.c
patch
|
blob
|
history
diff --git
a/appl/ftp/ftp/security.c
b/appl/ftp/ftp/security.c
index 77ed2f030b8269e5735e6edfa28f44af89f2e3fa..f186ab8189551d532a207d55def94e822d7cc56f 100644
(file)
--- a/
appl/ftp/ftp/security.c
+++ b/
appl/ftp/ftp/security.c
@@
-550,14
+550,20
@@
void mec(char *msg, enum protection_level level)
}
buf_size = strlen(msg) + 2;
buf = malloc(buf_size);
+ if (buf == NULL) {
+ reply(501, "Failed to allocate %lu", (unsigned long)buf_size);
+ return;
+ }
len = base64_decode(msg, buf);
command_prot = level;
if(len == (size_t)-1) {
+ free(buf);
reply(501, "Failed to base64-decode command");
return;
}
len = (*mech->decode)(app_data, buf, len, level);
if(len == (size_t)-1) {
+ free(buf);
reply(535, "Failed to decode command");
return;
}