mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Eliminate leak and heap buffer overrun. Bug 315994. r=julien, sr=rrelyea
This commit is contained in:
parent
0f7a9e6f4f
commit
f3033246a0
@ -37,7 +37,7 @@
|
||||
/*
|
||||
* Test program for SDR (Secret Decoder Ring) functions.
|
||||
*
|
||||
* $Id: pwdecrypt.c,v 1.3 2004/07/28 21:10:07 nelsonb%netscape.com Exp $
|
||||
* $Id: pwdecrypt.c,v 1.4 2005/11/15 23:40:18 nelsonb%netscape.com Exp $
|
||||
*/
|
||||
|
||||
#include "nspr.h"
|
||||
@ -317,8 +317,8 @@ main (int argc, char **argv)
|
||||
free(dataString);
|
||||
continue;
|
||||
}
|
||||
result.data = malloc(inText->len+1);
|
||||
result.len = inText->len+1;
|
||||
result.data = NULL;
|
||||
result.len = 0;
|
||||
rv = PK11SDR_Decrypt(inText, &result, NULL);
|
||||
SECITEM_FreeItem(inText, PR_TRUE);
|
||||
if (rv != SECSuccess) {
|
||||
@ -330,12 +330,12 @@ main (int argc, char **argv)
|
||||
}
|
||||
fputs(dataString,outFile);
|
||||
free(dataString);
|
||||
free(result.data);
|
||||
SECITEM_ZfreeItem(&result, PR_FALSE);
|
||||
continue;
|
||||
}
|
||||
result.data[result.len] = 0;
|
||||
fputs(result.data,outFile);
|
||||
free(result.data);
|
||||
/* result buffer has no extra space for a NULL */
|
||||
fprintf(outFile, "%.*s", result.len, result.data);
|
||||
SECITEM_ZfreeItem(&result, PR_FALSE);
|
||||
} else {
|
||||
putc(c,outFile);
|
||||
}
|
||||
@ -356,18 +356,3 @@ prdone:
|
||||
PR_Cleanup ();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user