idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
36,800 | static int vmac_init_tfm(struct crypto_tfm *tfm)
{
struct crypto_cipher *cipher;
struct crypto_instance *inst = (void *)tfm->__crt_alg;
struct crypto_spawn *spawn = crypto_instance_ctx(inst);
struct vmac_ctx_t *ctx = crypto_tfm_ctx(tfm);
cipher = crypto_spawn_cipher(spawn);
if (IS_ERR(cipher))
return PTR_ERR(c... | null | 0 | static int vmac_init_tfm(struct crypto_tfm *tfm)
{
struct crypto_cipher *cipher;
struct crypto_instance *inst = (void *)tfm->__crt_alg;
struct crypto_spawn *spawn = crypto_instance_ctx(inst);
struct vmac_ctx_t *ctx = crypto_tfm_ctx(tfm);
cipher = crypto_spawn_cipher(spawn);
if (IS_ERR(cipher))
return PTR_ERR(c... | @@ -713,3 +713,4 @@ module_exit(vmac_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VMAC hash algorithm");
+MODULE_ALIAS_CRYPTO("vmac"); | CWE-264 | null | null |
36,801 | static void __exit vmac_module_exit(void)
{
crypto_unregister_template(&vmac_tmpl);
}
| null | 0 | static void __exit vmac_module_exit(void)
{
crypto_unregister_template(&vmac_tmpl);
}
| @@ -713,3 +713,4 @@ module_exit(vmac_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VMAC hash algorithm");
+MODULE_ALIAS_CRYPTO("vmac"); | CWE-264 | null | null |
36,802 | static int vmac_set_key(unsigned char user_key[], struct vmac_ctx_t *ctx)
{
u64 in[2] = {0}, out[2];
unsigned i;
int err = 0;
err = crypto_cipher_setkey(ctx->child, user_key, VMAC_KEY_LEN);
if (err)
return err;
/* Fill nh key */
((unsigned char *)in)[0] = 0x80;
for (i = 0; i < sizeof(ctx->__vmac_ctx.nhkey)/... | null | 0 | static int vmac_set_key(unsigned char user_key[], struct vmac_ctx_t *ctx)
{
u64 in[2] = {0}, out[2];
unsigned i;
int err = 0;
err = crypto_cipher_setkey(ctx->child, user_key, VMAC_KEY_LEN);
if (err)
return err;
/* Fill nh key */
((unsigned char *)in)[0] = 0x80;
for (i = 0; i < sizeof(ctx->__vmac_ctx.nhkey)/... | @@ -713,3 +713,4 @@ module_exit(vmac_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VMAC hash algorithm");
+MODULE_ALIAS_CRYPTO("vmac"); | CWE-264 | null | null |
36,803 | static int vmac_update(struct shash_desc *pdesc, const u8 *p,
unsigned int len)
{
struct crypto_shash *parent = pdesc->tfm;
struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
int expand;
int min;
expand = VMAC_NHBYTES - ctx->partial_size > 0 ?
VMAC_NHBYTES - ctx->partial_size : 0;
min = len < expand ? len ... | null | 0 | static int vmac_update(struct shash_desc *pdesc, const u8 *p,
unsigned int len)
{
struct crypto_shash *parent = pdesc->tfm;
struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
int expand;
int min;
expand = VMAC_NHBYTES - ctx->partial_size > 0 ?
VMAC_NHBYTES - ctx->partial_size : 0;
min = len < expand ? len ... | @@ -713,3 +713,4 @@ module_exit(vmac_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VMAC hash algorithm");
+MODULE_ALIAS_CRYPTO("vmac"); | CWE-264 | null | null |
36,804 | static int crypto_xcbc_digest_final(struct shash_desc *pdesc, u8 *out)
{
struct crypto_shash *parent = pdesc->tfm;
unsigned long alignmask = crypto_shash_alignmask(parent);
struct xcbc_tfm_ctx *tctx = crypto_shash_ctx(parent);
struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc);
struct crypto_cipher *tfm = tctx->chi... | null | 0 | static int crypto_xcbc_digest_final(struct shash_desc *pdesc, u8 *out)
{
struct crypto_shash *parent = pdesc->tfm;
unsigned long alignmask = crypto_shash_alignmask(parent);
struct xcbc_tfm_ctx *tctx = crypto_shash_ctx(parent);
struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc);
struct crypto_cipher *tfm = tctx->chi... | @@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XCBC keyed hash algorithm");
+MODULE_ALIAS_CRYPTO("xcbc"); | CWE-264 | null | null |
36,805 | static int crypto_xcbc_digest_init(struct shash_desc *pdesc)
{
unsigned long alignmask = crypto_shash_alignmask(pdesc->tfm);
struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc);
int bs = crypto_shash_blocksize(pdesc->tfm);
u8 *prev = PTR_ALIGN(&ctx->ctx[0], alignmask + 1) + bs;
ctx->len = 0;
memset(prev, 0, bs);
... | null | 0 | static int crypto_xcbc_digest_init(struct shash_desc *pdesc)
{
unsigned long alignmask = crypto_shash_alignmask(pdesc->tfm);
struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc);
int bs = crypto_shash_blocksize(pdesc->tfm);
u8 *prev = PTR_ALIGN(&ctx->ctx[0], alignmask + 1) + bs;
ctx->len = 0;
memset(prev, 0, bs);
... | @@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XCBC keyed hash algorithm");
+MODULE_ALIAS_CRYPTO("xcbc"); | CWE-264 | null | null |
36,806 | static int crypto_xcbc_digest_setkey(struct crypto_shash *parent,
const u8 *inkey, unsigned int keylen)
{
unsigned long alignmask = crypto_shash_alignmask(parent);
struct xcbc_tfm_ctx *ctx = crypto_shash_ctx(parent);
int bs = crypto_shash_blocksize(parent);
u8 *consts = PTR_ALIGN(&ctx->ctx[0], alignmask + ... | null | 0 | static int crypto_xcbc_digest_setkey(struct crypto_shash *parent,
const u8 *inkey, unsigned int keylen)
{
unsigned long alignmask = crypto_shash_alignmask(parent);
struct xcbc_tfm_ctx *ctx = crypto_shash_ctx(parent);
int bs = crypto_shash_blocksize(parent);
u8 *consts = PTR_ALIGN(&ctx->ctx[0], alignmask + ... | @@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XCBC keyed hash algorithm");
+MODULE_ALIAS_CRYPTO("xcbc"); | CWE-264 | null | null |
36,807 | static int crypto_xcbc_digest_update(struct shash_desc *pdesc, const u8 *p,
unsigned int len)
{
struct crypto_shash *parent = pdesc->tfm;
unsigned long alignmask = crypto_shash_alignmask(parent);
struct xcbc_tfm_ctx *tctx = crypto_shash_ctx(parent);
struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc);
struc... | null | 0 | static int crypto_xcbc_digest_update(struct shash_desc *pdesc, const u8 *p,
unsigned int len)
{
struct crypto_shash *parent = pdesc->tfm;
unsigned long alignmask = crypto_shash_alignmask(parent);
struct xcbc_tfm_ctx *tctx = crypto_shash_ctx(parent);
struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc);
struc... | @@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XCBC keyed hash algorithm");
+MODULE_ALIAS_CRYPTO("xcbc"); | CWE-264 | null | null |
36,808 | static void __exit crypto_xcbc_module_exit(void)
{
crypto_unregister_template(&crypto_xcbc_tmpl);
}
| null | 0 | static void __exit crypto_xcbc_module_exit(void)
{
crypto_unregister_template(&crypto_xcbc_tmpl);
}
| @@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XCBC keyed hash algorithm");
+MODULE_ALIAS_CRYPTO("xcbc"); | CWE-264 | null | null |
36,809 | static int __init crypto_xcbc_module_init(void)
{
return crypto_register_template(&crypto_xcbc_tmpl);
}
| null | 0 | static int __init crypto_xcbc_module_init(void)
{
return crypto_register_template(&crypto_xcbc_tmpl);
}
| @@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XCBC keyed hash algorithm");
+MODULE_ALIAS_CRYPTO("xcbc"); | CWE-264 | null | null |
36,810 | static int xcbc_create(struct crypto_template *tmpl, struct rtattr **tb)
{
struct shash_instance *inst;
struct crypto_alg *alg;
unsigned long alignmask;
int err;
err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SHASH);
if (err)
return err;
alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
CRYPTO_AL... | null | 0 | static int xcbc_create(struct crypto_template *tmpl, struct rtattr **tb)
{
struct shash_instance *inst;
struct crypto_alg *alg;
unsigned long alignmask;
int err;
err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SHASH);
if (err)
return err;
alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
CRYPTO_AL... | @@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XCBC keyed hash algorithm");
+MODULE_ALIAS_CRYPTO("xcbc"); | CWE-264 | null | null |
36,811 | static int xcbc_init_tfm(struct crypto_tfm *tfm)
{
struct crypto_cipher *cipher;
struct crypto_instance *inst = (void *)tfm->__crt_alg;
struct crypto_spawn *spawn = crypto_instance_ctx(inst);
struct xcbc_tfm_ctx *ctx = crypto_tfm_ctx(tfm);
cipher = crypto_spawn_cipher(spawn);
if (IS_ERR(cipher))
return PTR_ERR... | null | 0 | static int xcbc_init_tfm(struct crypto_tfm *tfm)
{
struct crypto_cipher *cipher;
struct crypto_instance *inst = (void *)tfm->__crt_alg;
struct crypto_spawn *spawn = crypto_instance_ctx(inst);
struct xcbc_tfm_ctx *ctx = crypto_tfm_ctx(tfm);
cipher = crypto_spawn_cipher(spawn);
if (IS_ERR(cipher))
return PTR_ERR... | @@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XCBC keyed hash algorithm");
+MODULE_ALIAS_CRYPTO("xcbc"); | CWE-264 | null | null |
36,812 | static struct crypto_instance *alloc(struct rtattr **tb)
{
struct crypto_instance *inst;
struct crypto_alg *alg;
int err;
err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_BLKCIPHER);
if (err)
return ERR_PTR(err);
alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
CRYPTO_ALG_TYPE_MASK);
if (IS_ERR(al... | null | 0 | static struct crypto_instance *alloc(struct rtattr **tb)
{
struct crypto_instance *inst;
struct crypto_alg *alg;
int err;
err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_BLKCIPHER);
if (err)
return ERR_PTR(err);
alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
CRYPTO_ALG_TYPE_MASK);
if (IS_ERR(al... | @@ -362,3 +362,4 @@ module_exit(crypto_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XTS block cipher mode");
+MODULE_ALIAS_CRYPTO("xts"); | CWE-264 | null | null |
36,813 | static int decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
struct scatterlist *src, unsigned int nbytes)
{
struct priv *ctx = crypto_blkcipher_ctx(desc->tfm);
struct blkcipher_walk w;
blkcipher_walk_init(&w, dst, src, nbytes);
return crypt(desc, &w, ctx, crypto_cipher_alg(ctx->tweak)->cia_encryp... | null | 0 | static int decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
struct scatterlist *src, unsigned int nbytes)
{
struct priv *ctx = crypto_blkcipher_ctx(desc->tfm);
struct blkcipher_walk w;
blkcipher_walk_init(&w, dst, src, nbytes);
return crypt(desc, &w, ctx, crypto_cipher_alg(ctx->tweak)->cia_encryp... | @@ -362,3 +362,4 @@ module_exit(crypto_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XTS block cipher mode");
+MODULE_ALIAS_CRYPTO("xts"); | CWE-264 | null | null |
36,814 | static void exit_tfm(struct crypto_tfm *tfm)
{
struct priv *ctx = crypto_tfm_ctx(tfm);
crypto_free_cipher(ctx->child);
crypto_free_cipher(ctx->tweak);
}
| null | 0 | static void exit_tfm(struct crypto_tfm *tfm)
{
struct priv *ctx = crypto_tfm_ctx(tfm);
crypto_free_cipher(ctx->child);
crypto_free_cipher(ctx->tweak);
}
| @@ -362,3 +362,4 @@ module_exit(crypto_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XTS block cipher mode");
+MODULE_ALIAS_CRYPTO("xts"); | CWE-264 | null | null |
36,815 | static int init_tfm(struct crypto_tfm *tfm)
{
struct crypto_cipher *cipher;
struct crypto_instance *inst = (void *)tfm->__crt_alg;
struct crypto_spawn *spawn = crypto_instance_ctx(inst);
struct priv *ctx = crypto_tfm_ctx(tfm);
u32 *flags = &tfm->crt_flags;
cipher = crypto_spawn_cipher(spawn);
if (IS_ERR(cipher)... | null | 0 | static int init_tfm(struct crypto_tfm *tfm)
{
struct crypto_cipher *cipher;
struct crypto_instance *inst = (void *)tfm->__crt_alg;
struct crypto_spawn *spawn = crypto_instance_ctx(inst);
struct priv *ctx = crypto_tfm_ctx(tfm);
u32 *flags = &tfm->crt_flags;
cipher = crypto_spawn_cipher(spawn);
if (IS_ERR(cipher)... | @@ -362,3 +362,4 @@ module_exit(crypto_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XTS block cipher mode");
+MODULE_ALIAS_CRYPTO("xts"); | CWE-264 | null | null |
36,816 | static int setkey(struct crypto_tfm *parent, const u8 *key,
unsigned int keylen)
{
struct priv *ctx = crypto_tfm_ctx(parent);
struct crypto_cipher *child = ctx->tweak;
u32 *flags = &parent->crt_flags;
int err;
/* key consists of keys of equal size concatenated, therefore
* the length must be even */
if (ke... | null | 0 | static int setkey(struct crypto_tfm *parent, const u8 *key,
unsigned int keylen)
{
struct priv *ctx = crypto_tfm_ctx(parent);
struct crypto_cipher *child = ctx->tweak;
u32 *flags = &parent->crt_flags;
int err;
/* key consists of keys of equal size concatenated, therefore
* the length must be even */
if (ke... | @@ -362,3 +362,4 @@ module_exit(crypto_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XTS block cipher mode");
+MODULE_ALIAS_CRYPTO("xts"); | CWE-264 | null | null |
36,817 | static inline void xts_round(struct sinfo *s, void *dst, const void *src)
{
be128_xor(dst, s->t, src); /* PP <- T xor P */
s->fn(s->tfm, dst, dst); /* CC <- E(Key1,PP) */
be128_xor(dst, dst, s->t); /* C <- T xor CC */
}
| null | 0 | static inline void xts_round(struct sinfo *s, void *dst, const void *src)
{
be128_xor(dst, s->t, src); /* PP <- T xor P */
s->fn(s->tfm, dst, dst); /* CC <- E(Key1,PP) */
be128_xor(dst, dst, s->t); /* C <- T xor CC */
}
| @@ -362,3 +362,4 @@ module_exit(crypto_module_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XTS block cipher mode");
+MODULE_ALIAS_CRYPTO("xts"); | CWE-264 | null | null |
36,818 | do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap __attribute__((__unused__)), uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
type == NT_GNU_BUILD_ID && (descsz == 16 || descsz == 20)) {
... | DoS | 0 | do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap __attribute__((__unused__)), uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
type == NT_GNU_BUILD_ID && (descsz == 16 || descsz == 20)) {
... | @@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.115 2014/12/16 20:53:05 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.116 2014/12/16 23:18:40 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -900,26 +900,31 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, s... | CWE-399 | null | null |
36,819 | do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap, uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags, size_t size, int clazz)
{
#ifdef ELFCORE
int os_style = -1;
/*
* Sigh. The 2.0.36 kernel in Debian 2.1, at
* least, doesn't correctly implement name
*... | DoS | 0 | do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap, uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags, size_t size, int clazz)
{
#ifdef ELFCORE
int os_style = -1;
/*
* Sigh. The 2.0.36 kernel in Debian 2.1, at
* least, doesn't correctly implement name
*... | @@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.115 2014/12/16 20:53:05 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.116 2014/12/16 23:18:40 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -900,26 +900,31 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, s... | CWE-399 | null | null |
36,820 | do_pax_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap, uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "PaX") == 0 &&
type == NT_NETBSD_PAX && descsz == 4) {
static const char *pax[] = {
"+mprotect",
... | DoS | 0 | do_pax_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap, uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "PaX") == 0 &&
type == NT_NETBSD_PAX && descsz == 4) {
static const char *pax[] = {
"+mprotect",
... | @@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.115 2014/12/16 20:53:05 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.116 2014/12/16 23:18:40 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -900,26 +900,31 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, s... | CWE-399 | null | null |
36,821 | dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
int num, size_t size, off_t fsize, int *flags, uint16_t *notecount)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
size_t offset, len;
unsigned char nbuf[BUFSIZ];
ssize_t bufsize;
if (size != xph_sizeof) {
if (file_printf(ms, ", corrupted progra... | DoS | 0 | dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
int num, size_t size, off_t fsize, int *flags, uint16_t *notecount)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
size_t offset, len;
unsigned char nbuf[BUFSIZ];
ssize_t bufsize;
if (size != xph_sizeof) {
if (file_printf(ms, ", corrupted progra... | @@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.115 2014/12/16 20:53:05 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.116 2014/12/16 23:18:40 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -900,26 +900,31 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, s... | CWE-399 | null | null |
36,822 | dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
int num, size_t size, off_t fsize, int sh_num, int *flags,
uint16_t *notecount)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
const char *linking_style = "statically";
const char *interp = "";
unsigned char nbuf[BUFSIZ];
char ibuf[BUFSIZ];
ss... | DoS | 0 | dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
int num, size_t size, off_t fsize, int sh_num, int *flags,
uint16_t *notecount)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
const char *linking_style = "statically";
const char *interp = "";
unsigned char nbuf[BUFSIZ];
char ibuf[BUFSIZ];
ss... | @@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.115 2014/12/16 20:53:05 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.116 2014/12/16 23:18:40 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -900,26 +900,31 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, s... | CWE-399 | null | null |
36,823 | doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
size_t size, off_t fsize, int mach, int strtab, int *flags,
uint16_t *notecount)
{
Elf32_Shdr sh32;
Elf64_Shdr sh64;
int stripped = 1;
size_t nbadcap = 0;
void *nbuf;
off_t noff, coff, name_off;
uint64_t cap_hw1 = 0; /* SunOS 5.... | DoS | 0 | doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
size_t size, off_t fsize, int mach, int strtab, int *flags,
uint16_t *notecount)
{
Elf32_Shdr sh32;
Elf64_Shdr sh64;
int stripped = 1;
size_t nbadcap = 0;
void *nbuf;
off_t noff, coff, name_off;
uint64_t cap_hw1 = 0; /* SunOS 5.... | @@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.115 2014/12/16 20:53:05 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.116 2014/12/16 23:18:40 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -900,26 +900,31 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, s... | CWE-399 | null | null |
36,824 | file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
size_t nbytes)
{
union {
int32_t l;
char c[sizeof (int32_t)];
} u;
int clazz;
int swap;
struct stat st;
off_t fsize;
int flags = 0;
Elf32_Ehdr elf32hdr;
Elf64_Ehdr elf64hdr;
uint16_t type, phnum, shnum, notecount;
if (ms->flags & (M... | DoS | 0 | file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
size_t nbytes)
{
union {
int32_t l;
char c[sizeof (int32_t)];
} u;
int clazz;
int swap;
struct stat st;
off_t fsize;
int flags = 0;
Elf32_Ehdr elf32hdr;
Elf64_Ehdr elf64hdr;
uint16_t type, phnum, shnum, notecount;
if (ms->flags & (M... | @@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.115 2014/12/16 20:53:05 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.116 2014/12/16 23:18:40 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -900,26 +900,31 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, s... | CWE-399 | null | null |
36,825 | toomany(struct magic_set *ms, const char *name, uint16_t num)
{
if (file_printf(ms, ", too many %s (%u)", name, num
) == -1)
return -1;
return 0;
}
| DoS | 0 | toomany(struct magic_set *ms, const char *name, uint16_t num)
{
if (file_printf(ms, ", too many %s (%u)", name, num
) == -1)
return -1;
return 0;
}
| @@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.115 2014/12/16 20:53:05 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.116 2014/12/16 23:18:40 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -900,26 +900,31 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, s... | CWE-399 | null | null |
36,826 | apprentice_1(struct magic_set *ms, const char *fn, int action)
{
struct magic_map *map;
#ifndef COMPILE_ONLY
struct mlist *ml;
size_t i;
#endif
if (magicsize != FILE_MAGICSIZE) {
file_error(ms, 0, "magic element size %lu != %lu",
(unsigned long)sizeof(*map->magic[0]),
(unsigned long)FILE_MAGICSIZE);
... | DoS | 0 | apprentice_1(struct magic_set *ms, const char *fn, int action)
{
struct magic_map *map;
#ifndef COMPILE_ONLY
struct mlist *ml;
size_t i;
#endif
if (magicsize != FILE_MAGICSIZE) {
file_error(ms, 0, "magic element size %lu != %lu",
(unsigned long)sizeof(*map->magic[0]),
(unsigned long)FILE_MAGICSIZE);
... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,827 | apprentice_map(struct magic_set *ms, const char *fn)
{
int fd;
struct stat st;
char *dbname = NULL;
struct magic_map *map;
fd = -1;
if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
file_oomem(ms, sizeof(*map));
goto error;
}
dbname = mkdbname(ms, fn, 0);
if (dbname == NULL)
goto... | DoS | 0 | apprentice_map(struct magic_set *ms, const char *fn)
{
int fd;
struct stat st;
char *dbname = NULL;
struct magic_map *map;
fd = -1;
if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
file_oomem(ms, sizeof(*map));
goto error;
}
dbname = mkdbname(ms, fn, 0);
if (dbname == NULL)
goto... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,828 | apprentice_unmap(struct magic_map *map)
{
if (map == NULL)
return;
switch (map->type) {
#ifdef QUICK
case MAP_TYPE_MMAP:
if (map->p)
(void)munmap(map->p, map->len);
break;
#endif
case MAP_TYPE_MALLOC:
free(map->p);
break;
case MAP_TYPE_USER:
break;
default:
abort();
}
free(map);
}
| DoS | 0 | apprentice_unmap(struct magic_map *map)
{
if (map == NULL)
return;
switch (map->type) {
#ifdef QUICK
case MAP_TYPE_MMAP:
if (map->p)
(void)munmap(map->p, map->len);
break;
#endif
case MAP_TYPE_MALLOC:
free(map->p);
break;
case MAP_TYPE_USER:
break;
default:
abort();
}
free(map);
}
| @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,829 | buffer_apprentice(struct magic_set *ms, struct magic **bufs,
size_t *sizes, size_t nbufs)
{
size_t i, j;
struct mlist *ml;
struct magic_map *map;
if (nbufs == 0)
return -1;
if (ms->mlist[0] != NULL)
file_reset(ms);
init_file_tables();
for (i = 0; i < MAGIC_SETS; i++) {
mlist_free(ms->mlist[i]);
i... | DoS | 0 | buffer_apprentice(struct magic_set *ms, struct magic **bufs,
size_t *sizes, size_t nbufs)
{
size_t i, j;
struct mlist *ml;
struct magic_map *map;
if (nbufs == 0)
return -1;
if (ms->mlist[0] != NULL)
file_reset(ms);
init_file_tables();
for (i = 0; i < MAGIC_SETS; i++) {
mlist_free(ms->mlist[i]);
i... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,830 | file_apprentice(struct magic_set *ms, const char *fn, int action)
{
char *p, *mfn;
int file_err, errs = -1;
size_t i;
if (ms->mlist[0] != NULL)
file_reset(ms);
if ((fn = magic_getpath(fn, action)) == NULL)
return -1;
init_file_tables();
if ((mfn = strdup(fn)) == NULL) {
file_oomem(ms, strlen(fn));
re... | DoS | 0 | file_apprentice(struct magic_set *ms, const char *fn, int action)
{
char *p, *mfn;
int file_err, errs = -1;
size_t i;
if (ms->mlist[0] != NULL)
file_reset(ms);
if ((fn = magic_getpath(fn, action)) == NULL)
return -1;
init_file_tables();
if ((mfn = strdup(fn)) == NULL) {
file_oomem(ms, strlen(fn));
re... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,831 | goodchar(unsigned char x, const char *extra)
{
return (isascii(x) && isalnum(x)) || strchr(extra, x);
}
| DoS | 0 | goodchar(unsigned char x, const char *extra)
{
return (isascii(x) && isalnum(x)) || strchr(extra, x);
}
| @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,832 | mlist_free(struct mlist *mlist)
{
struct mlist *ml, *next;
if (mlist == NULL)
return;
ml = mlist->next;
for (ml = mlist->next; (next = ml->next) != NULL; ml = next) {
if (ml->map)
apprentice_unmap(ml->map);
free(ml);
if (ml == mlist)
break;
}
}
| DoS | 0 | mlist_free(struct mlist *mlist)
{
struct mlist *ml, *next;
if (mlist == NULL)
return;
ml = mlist->next;
for (ml = mlist->next; (next = ml->next) != NULL; ml = next) {
if (ml->map)
apprentice_unmap(ml->map);
free(ml);
if (ml == mlist)
break;
}
}
| @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,833 | parse(struct magic_set *ms, struct magic_entry *me, const char *line,
size_t lineno, int action)
{
#ifdef ENABLE_CONDITIONALS
static uint32_t last_cont_level = 0;
#endif
size_t i;
struct magic *m;
const char *l = line;
char *t;
int op;
uint32_t cont_level;
int32_t diff;
cont_level = 0;
/*
* Parse the ... | DoS | 0 | parse(struct magic_set *ms, struct magic_entry *me, const char *line,
size_t lineno, int action)
{
#ifdef ENABLE_CONDITIONALS
static uint32_t last_cont_level = 0;
#endif
size_t i;
struct magic *m;
const char *l = line;
char *t;
int op;
uint32_t cont_level;
int32_t diff;
cont_level = 0;
/*
* Parse the ... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,834 | parse_apple(struct magic_set *ms, struct magic_entry *me, const char *line)
{
struct magic *m = &me->mp[0];
return parse_extra(ms, me, line, offsetof(struct magic, apple),
sizeof(m->apple), "APPLE", "!+-./", 0);
}
| DoS | 0 | parse_apple(struct magic_set *ms, struct magic_entry *me, const char *line)
{
struct magic *m = &me->mp[0];
return parse_extra(ms, me, line, offsetof(struct magic, apple),
sizeof(m->apple), "APPLE", "!+-./", 0);
}
| @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,835 | parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line,
off_t off, size_t len, const char *name, const char *extra, int nt)
{
size_t i;
const char *l = line;
struct magic *m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1];
char *buf = (char *)m + off;
if (buf[0] != '\0') {
len = ... | DoS | 0 | parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line,
off_t off, size_t len, const char *name, const char *extra, int nt)
{
size_t i;
const char *l = line;
struct magic *m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1];
char *buf = (char *)m + off;
if (buf[0] != '\0') {
len = ... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,836 | string_modifier_check(struct magic_set *ms, struct magic *m)
{
if ((ms->flags & MAGIC_CHECK) == 0)
return 0;
if ((m->type != FILE_REGEX || (m->str_flags & REGEX_LINE_COUNT) == 0) &&
(m->type != FILE_PSTRING && (m->str_flags & PSTRING_LEN) != 0)) {
file_magwarn(ms,
"'/BHhLl' modifiers are only allowed ... | DoS | 0 | string_modifier_check(struct magic_set *ms, struct magic *m)
{
if ((ms->flags & MAGIC_CHECK) == 0)
return 0;
if ((m->type != FILE_REGEX || (m->str_flags & REGEX_LINE_COUNT) == 0) &&
(m->type != FILE_PSTRING && (m->str_flags & PSTRING_LEN) != 0)) {
file_magwarn(ms,
"'/BHhLl' modifiers are only allowed ... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.226 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.227 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -528,6 +528,7 @@ file_ms_alloc(int flags)
ms->name_max = ... | CWE-399 | null | null |
36,837 | applyparam(magic_t magic)
{
size_t i;
for (i = 0; i < __arraycount(pm); i++) {
if (pm[i].value == 0)
continue;
if (magic_setparam(magic, pm[i].tag, &pm[i].value) == -1) {
(void)fprintf(stderr, "%s: Can't set %s %s\n", progname,
pm[i].name, strerror(errno));
exit(1);
}
}
}
| DoS | 0 | applyparam(magic_t magic)
{
size_t i;
for (i = 0; i < __arraycount(pm); i++) {
if (pm[i].value == 0)
continue;
if (magic_setparam(magic, pm[i].tag, &pm[i].value) == -1) {
(void)fprintf(stderr, "%s: Can't set %s %s\n", progname,
pm[i].name, strerror(errno));
exit(1);
}
}
}
| @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.158 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.159 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -125,6 +125,7 @@ private struct {
{ "name", MAGIC_PARAM_NAME_MAX, 0 }... | CWE-399 | null | null |
36,838 | docprint(const char *opts)
{
size_t i;
int comma;
char *sp, *p;
p = strstr(opts, "%o");
if (p == NULL) {
fprintf(stdout, "%s", opts);
return;
}
for (sp = p - 1; sp > opts && *sp == ' '; sp--)
continue;
fprintf(stdout, "%.*s", (int)(p - opts), opts);
comma = 0;
for (i = 0; i < __arraycount(nv); i++) ... | DoS | 0 | docprint(const char *opts)
{
size_t i;
int comma;
char *sp, *p;
p = strstr(opts, "%o");
if (p == NULL) {
fprintf(stdout, "%s", opts);
return;
}
for (sp = p - 1; sp > opts && *sp == ' '; sp--)
continue;
fprintf(stdout, "%.*s", (int)(p - opts), opts);
comma = 0;
for (i = 0; i < __arraycount(nv); i++) ... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.158 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.159 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -125,6 +125,7 @@ private struct {
{ "name", MAGIC_PARAM_NAME_MAX, 0 }... | CWE-399 | null | null |
36,839 | help(void)
{
(void)fputs(
"Usage: file [OPTION...] [FILE...]\n"
"Determine type of FILEs.\n"
"\n", stdout);
#define OPT(shortname, longname, opt, doc) \
fprintf(stdout, " -%c, --" longname, shortname), \
docprint(doc);
#define OPT_LONGONLY(longname, opt, doc) \
fprintf(stdout, " --" longname), \
... | DoS | 0 | help(void)
{
(void)fputs(
"Usage: file [OPTION...] [FILE...]\n"
"Determine type of FILEs.\n"
"\n", stdout);
#define OPT(shortname, longname, opt, doc) \
fprintf(stdout, " -%c, --" longname, shortname), \
docprint(doc);
#define OPT_LONGONLY(longname, opt, doc) \
fprintf(stdout, " --" longname), \
... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.158 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.159 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -125,6 +125,7 @@ private struct {
{ "name", MAGIC_PARAM_NAME_MAX, 0 }... | CWE-399 | null | null |
36,840 | load(const char *magicfile, int flags)
{
struct magic_set *magic = magic_open(flags);
if (magic == NULL) {
(void)fprintf(stderr, "%s: %s\n", progname, strerror(errno));
return NULL;
}
if (magic_load(magic, magicfile) == -1) {
(void)fprintf(stderr, "%s: %s\n",
progname, magic_error(magic));
magic_close... | DoS | 0 | load(const char *magicfile, int flags)
{
struct magic_set *magic = magic_open(flags);
if (magic == NULL) {
(void)fprintf(stderr, "%s: %s\n", progname, strerror(errno));
return NULL;
}
if (magic_load(magic, magicfile) == -1) {
(void)fprintf(stderr, "%s: %s\n",
progname, magic_error(magic));
magic_close... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.158 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.159 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -125,6 +125,7 @@ private struct {
{ "name", MAGIC_PARAM_NAME_MAX, 0 }... | CWE-399 | null | null |
36,841 | main(int argc, char *argv[])
{
int c;
size_t i;
int action = 0, didsomefiles = 0, errflg = 0;
int flags = 0, e = 0;
struct magic_set *magic = NULL;
int longindex;
const char *magicfile = NULL; /* where the magic is */
/* makes islower etc work for other langs */
#ifdef HAVE_SETLOCALE
(void)setlocale(LC_CTYPE... | DoS | 0 | main(int argc, char *argv[])
{
int c;
size_t i;
int action = 0, didsomefiles = 0, errflg = 0;
int flags = 0, e = 0;
struct magic_set *magic = NULL;
int longindex;
const char *magicfile = NULL; /* where the magic is */
/* makes islower etc work for other langs */
#ifdef HAVE_SETLOCALE
(void)setlocale(LC_CTYPE... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.158 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.159 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -125,6 +125,7 @@ private struct {
{ "name", MAGIC_PARAM_NAME_MAX, 0 }... | CWE-399 | null | null |
36,842 | process(struct magic_set *ms, const char *inname, int wid)
{
const char *type;
int std_in = strcmp(inname, "-") == 0;
if (wid > 0 && !bflag) {
(void)printf("%s", std_in ? "/dev/stdin" : inname);
if (nulsep)
(void)putc('\0', stdout);
(void)printf("%s", separator);
(void)printf("%*s ",
(int) (nopad ?... | DoS | 0 | process(struct magic_set *ms, const char *inname, int wid)
{
const char *type;
int std_in = strcmp(inname, "-") == 0;
if (wid > 0 && !bflag) {
(void)printf("%s", std_in ? "/dev/stdin" : inname);
if (nulsep)
(void)putc('\0', stdout);
(void)printf("%s", separator);
(void)printf("%*s ",
(int) (nopad ?... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.158 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.159 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -125,6 +125,7 @@ private struct {
{ "name", MAGIC_PARAM_NAME_MAX, 0 }... | CWE-399 | null | null |
36,843 | setparam(const char *p)
{
size_t i;
char *s;
if ((s = strchr(p, '=')) == NULL)
goto badparm;
for (i = 0; i < __arraycount(pm); i++) {
if (strncmp(p, pm[i].name, s - p) != 0)
continue;
pm[i].value = atoi(s + 1);
return;
}
badparm:
(void)fprintf(stderr, "%s: Unknown param %s\n", progname, p);
exit(1);... | DoS | 0 | setparam(const char *p)
{
size_t i;
char *s;
if ((s = strchr(p, '=')) == NULL)
goto badparm;
for (i = 0; i < __arraycount(pm); i++) {
if (strncmp(p, pm[i].name, s - p) != 0)
continue;
pm[i].value = atoi(s + 1);
return;
}
badparm:
(void)fprintf(stderr, "%s: Unknown param %s\n", progname, p);
exit(1);... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.158 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.159 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -125,6 +125,7 @@ private struct {
{ "name", MAGIC_PARAM_NAME_MAX, 0 }... | CWE-399 | null | null |
36,844 | unwrap(struct magic_set *ms, const char *fn)
{
FILE *f;
ssize_t len;
char *line = NULL;
size_t llen = 0;
int wid = 0, cwid;
int e = 0;
if (strcmp("-", fn) == 0) {
f = stdin;
wid = 1;
} else {
if ((f = fopen(fn, "r")) == NULL) {
(void)fprintf(stderr, "%s: Cannot open `%s' (%s).\n",
progname, fn,... | DoS | 0 | unwrap(struct magic_set *ms, const char *fn)
{
FILE *f;
ssize_t len;
char *line = NULL;
size_t llen = 0;
int wid = 0, cwid;
int e = 0;
if (strcmp("-", fn) == 0) {
f = stdin;
wid = 1;
} else {
if ((f = fopen(fn, "r")) == NULL) {
(void)fprintf(stderr, "%s: Cannot open `%s' (%s).\n",
progname, fn,... | @@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.158 2014/11/28 02:35:05 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.159 2014/11/28 02:46:39 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -125,6 +125,7 @@ private struct {
{ "name", MAGIC_PARAM_NAME_MAX, 0 }... | CWE-399 | null | null |
36,845 | close_and_restore(const struct magic_set *ms, const char *name, int fd,
const struct stat *sb)
{
if (fd == STDIN_FILENO || name == NULL)
return;
(void) close(fd);
if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) {
/*
* Try to restore access, modification times if read it.
* This is really *bad* because it... | DoS | 0 | close_and_restore(const struct magic_set *ms, const char *name, int fd,
const struct stat *sb)
{
if (fd == STDIN_FILENO || name == NULL)
return;
(void) close(fd);
if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) {
/*
* Try to restore access, modification times if read it.
* This is really *bad* because it... | @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,846 | file_or_fd(struct magic_set *ms, const char *inname, int fd)
{
int rv = -1;
unsigned char *buf;
struct stat sb;
ssize_t nbytes = 0; /* number of bytes read from a datafile */
int ispipe = 0;
off_t pos = (off_t)-1;
if (file_reset(ms) == -1)
goto out;
/*
* one extra for terminating '\0', and
* some overla... | DoS | 0 | file_or_fd(struct magic_set *ms, const char *inname, int fd)
{
int rv = -1;
unsigned char *buf;
struct stat sb;
ssize_t nbytes = 0; /* number of bytes read from a datafile */
int ispipe = 0;
off_t pos = (off_t)-1;
if (file_reset(ms) == -1)
goto out;
/*
* one extra for terminating '\0', and
* some overla... | @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,847 | get_default_magic(void)
{
static const char hmagic[] = "/.magic/magic.mgc";
static char *default_magic;
char *home, *hmagicpath;
#ifndef WIN32
struct stat st;
if (default_magic) {
free(default_magic);
default_magic = NULL;
}
if ((home = getenv("HOME")) == NULL)
return MAGIC;
if (asprintf(&hmagicpath, "... | DoS | 0 | get_default_magic(void)
{
static const char hmagic[] = "/.magic/magic.mgc";
static char *default_magic;
char *home, *hmagicpath;
#ifndef WIN32
struct stat st;
if (default_magic) {
free(default_magic);
default_magic = NULL;
}
if ((home = getenv("HOME")) == NULL)
return MAGIC;
if (asprintf(&hmagicpath, "... | @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,848 | magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
{
if (ms == NULL)
return NULL;
if (file_reset(ms) == -1)
return NULL;
/*
* The main work is done here!
* We have the file name and/or the data buffer to be identified.
*/
if (file_buffer(ms, -1, NULL, buf, nb) == -1) {
return NULL;
}
retur... | DoS | 0 | magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
{
if (ms == NULL)
return NULL;
if (file_reset(ms) == -1)
return NULL;
/*
* The main work is done here!
* We have the file name and/or the data buffer to be identified.
*/
if (file_buffer(ms, -1, NULL, buf, nb) == -1) {
return NULL;
}
retur... | @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,849 | magic_check(struct magic_set *ms, const char *magicfile)
{
if (ms == NULL)
return -1;
return file_apprentice(ms, magicfile, FILE_CHECK);
}
| DoS | 0 | magic_check(struct magic_set *ms, const char *magicfile)
{
if (ms == NULL)
return -1;
return file_apprentice(ms, magicfile, FILE_CHECK);
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,850 | magic_compile(struct magic_set *ms, const char *magicfile)
{
if (ms == NULL)
return -1;
return file_apprentice(ms, magicfile, FILE_COMPILE);
}
| DoS | 0 | magic_compile(struct magic_set *ms, const char *magicfile)
{
if (ms == NULL)
return -1;
return file_apprentice(ms, magicfile, FILE_COMPILE);
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,851 | magic_descriptor(struct magic_set *ms, int fd)
{
if (ms == NULL)
return NULL;
return file_or_fd(ms, NULL, fd);
}
| DoS | 0 | magic_descriptor(struct magic_set *ms, int fd)
{
if (ms == NULL)
return NULL;
return file_or_fd(ms, NULL, fd);
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,852 | magic_errno(struct magic_set *ms)
{
if (ms == NULL)
return EINVAL;
return (ms->event_flags & EVENT_HAD_ERR) ? ms->error : 0;
}
| DoS | 0 | magic_errno(struct magic_set *ms)
{
if (ms == NULL)
return EINVAL;
return (ms->event_flags & EVENT_HAD_ERR) ? ms->error : 0;
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,853 | magic_error(struct magic_set *ms)
{
if (ms == NULL)
return "Magic database is not open";
return (ms->event_flags & EVENT_HAD_ERR) ? ms->o.buf : NULL;
}
| DoS | 0 | magic_error(struct magic_set *ms)
{
if (ms == NULL)
return "Magic database is not open";
return (ms->event_flags & EVENT_HAD_ERR) ? ms->o.buf : NULL;
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,854 | magic_file(struct magic_set *ms, const char *inname)
{
if (ms == NULL)
return NULL;
return file_or_fd(ms, inname, STDIN_FILENO);
}
| DoS | 0 | magic_file(struct magic_set *ms, const char *inname)
{
if (ms == NULL)
return NULL;
return file_or_fd(ms, inname, STDIN_FILENO);
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,855 | magic_getpath(const char *magicfile, int action)
{
if (magicfile != NULL)
return magicfile;
magicfile = getenv("MAGIC");
if (magicfile != NULL)
return magicfile;
return action == FILE_LOAD ? get_default_magic() : MAGIC;
}
| DoS | 0 | magic_getpath(const char *magicfile, int action)
{
if (magicfile != NULL)
return magicfile;
magicfile = getenv("MAGIC");
if (magicfile != NULL)
return magicfile;
return action == FILE_LOAD ? get_default_magic() : MAGIC;
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,856 | magic_list(struct magic_set *ms, const char *magicfile)
{
if (ms == NULL)
return -1;
return file_apprentice(ms, magicfile, FILE_LIST);
}
| DoS | 0 | magic_list(struct magic_set *ms, const char *magicfile)
{
if (ms == NULL)
return -1;
return file_apprentice(ms, magicfile, FILE_LIST);
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,857 | magic_load_buffers(struct magic_set *ms, void **bufs, size_t *sizes,
size_t nbufs)
{
if (ms == NULL)
return -1;
return buffer_apprentice(ms, (struct magic **)bufs, sizes, nbufs);
}
| DoS | 0 | magic_load_buffers(struct magic_set *ms, void **bufs, size_t *sizes,
size_t nbufs)
{
if (ms == NULL)
return -1;
return buffer_apprentice(ms, (struct magic **)bufs, sizes, nbufs);
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,858 | magic_open(int flags)
{
return file_ms_alloc(flags);
}
| DoS | 0 | magic_open(int flags)
{
return file_ms_alloc(flags);
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,859 | magic_setflags(struct magic_set *ms, int flags)
{
if (ms == NULL)
return -1;
#if !defined(HAVE_UTIME) && !defined(HAVE_UTIMES)
if (flags & MAGIC_PRESERVE_ATIME)
return -1;
#endif
ms->flags = flags;
return 0;
}
| DoS | 0 | magic_setflags(struct magic_set *ms, int flags)
{
if (ms == NULL)
return -1;
#if !defined(HAVE_UTIME) && !defined(HAVE_UTIMES)
if (flags & MAGIC_PRESERVE_ATIME)
return -1;
#endif
ms->flags = flags;
return 0;
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,860 | magic_version(void)
{
return MAGIC_VERSION;
}
| DoS | 0 | magic_version(void)
{
return MAGIC_VERSION;
}
| @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,861 | unreadable_info(struct magic_set *ms, mode_t md, const char *file)
{
if (file) {
/* We cannot open it, but we were able to stat it. */
if (access(file, W_OK) == 0)
if (file_printf(ms, "writable, ") == -1)
return -1;
if (access(file, X_OK) == 0)
if (file_printf(ms, "executable, ") == -1)
return -1;
... | DoS | 0 | unreadable_info(struct magic_set *ms, mode_t md, const char *file)
{
if (file) {
/* We cannot open it, but we were able to stat it. */
if (access(file, W_OK) == 0)
if (file_printf(ms, "writable, ") == -1)
return -1;
if (access(file, X_OK) == 0)
if (file_printf(ms, "executable, ") == -1)
return -1;
... | @@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.89 2014/11/28 02:46:39 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.90 2014/12/04 15:56:46 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -554,6 +554,9 @@ magic_setparam(struct magic_set *ms, int param, const ... | CWE-399 | null | null |
36,862 | do_note_freebsd_version(struct magic_set *ms, int swap, void *v)
{
uint32_t desc;
(void)memcpy(&desc, v, sizeof(desc));
desc = elf_getu32(swap, desc);
if (file_printf(ms, ", for FreeBSD") == -1)
return;
/*
* Contents is __FreeBSD_version, whose relation to OS
* versions is defined by a huge table in the Po... | DoS | 0 | do_note_freebsd_version(struct magic_set *ms, int swap, void *v)
{
uint32_t desc;
(void)memcpy(&desc, v, sizeof(desc));
desc = elf_getu32(swap, desc);
if (file_printf(ms, ", for FreeBSD") == -1)
return;
/*
* Contents is __FreeBSD_version, whose relation to OS
* versions is defined by a huge table in the Po... | @@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.114 2014/12/11 14:19:36 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.115 2014/12/16 20:53:05 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -43,14 +43,14 @@ FILE_RCSID("@(#)$File: readelf.c,v 1.114 2014/12/11 14:19:3... | CWE-399 | null | null |
36,863 | parse_str_rsrc (SF_PRIVATE *psf, SD2_RSRC * rsrc)
{ char name [32], value [32] ;
int k, str_offset, rsrc_id, data_offset = 0, data_len = 0 ;
psf_log_printf (psf, "Finding parameters :\n") ;
str_offset = rsrc->string_offset ;
psf_log_printf (psf, " Offset RsrcId dlen slen Value\n") ;
for (k = 0 ; da... | Overflow | 0 | parse_str_rsrc (SF_PRIVATE *psf, SD2_RSRC * rsrc)
{ char name [32], value [32] ;
int k, str_offset, rsrc_id, data_offset = 0, data_len = 0 ;
psf_log_printf (psf, "Finding parameters :\n") ;
str_offset = rsrc->string_offset ;
psf_log_printf (psf, " Offset RsrcId dlen slen Value\n") ;
for (k = 0 ; da... | @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,864 | read_rsrc_char (const SD2_RSRC *prsrc, int offset)
{ const unsigned char * data = prsrc->rsrc_data ;
if (offset < 0 || offset >= prsrc->rsrc_len)
return 0 ;
return data [offset] ;
} /* read_rsrc_char */
| Overflow | 0 | read_rsrc_char (const SD2_RSRC *prsrc, int offset)
{ const unsigned char * data = prsrc->rsrc_data ;
if (offset < 0 || offset >= prsrc->rsrc_len)
return 0 ;
return data [offset] ;
} /* read_rsrc_char */
| @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,865 | read_rsrc_marker (const SD2_RSRC *prsrc, int offset)
{ const unsigned char * data = prsrc->rsrc_data ;
if (offset < 0 || offset + 3 >= prsrc->rsrc_len)
return 0 ;
if (CPU_IS_BIG_ENDIAN)
return (((uint32_t) data [offset]) << 24) + (data [offset + 1] << 16) + (data [offset + 2] << 8) + data [offset + 3] ;
if (CP... | Overflow | 0 | read_rsrc_marker (const SD2_RSRC *prsrc, int offset)
{ const unsigned char * data = prsrc->rsrc_data ;
if (offset < 0 || offset + 3 >= prsrc->rsrc_len)
return 0 ;
if (CPU_IS_BIG_ENDIAN)
return (((uint32_t) data [offset]) << 24) + (data [offset + 1] << 16) + (data [offset + 2] << 8) + data [offset + 3] ;
if (CP... | @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,866 | read_rsrc_str (const SD2_RSRC *prsrc, int offset, char * buffer, int buffer_len)
{ const unsigned char * data = prsrc->rsrc_data ;
int k ;
memset (buffer, 0, buffer_len) ;
if (offset < 0 || offset + buffer_len >= prsrc->rsrc_len)
return ;
for (k = 0 ; k < buffer_len - 1 ; k++)
{ if (psf_isprint (data [offset ... | Overflow | 0 | read_rsrc_str (const SD2_RSRC *prsrc, int offset, char * buffer, int buffer_len)
{ const unsigned char * data = prsrc->rsrc_data ;
int k ;
memset (buffer, 0, buffer_len) ;
if (offset < 0 || offset + buffer_len >= prsrc->rsrc_len)
return ;
for (k = 0 ; k < buffer_len - 1 ; k++)
{ if (psf_isprint (data [offset ... | @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,867 | sd2_close (SF_PRIVATE *psf)
{
if (psf->file.mode == SFM_WRITE)
{ /* Now we know for certain the audio_length of the file we can re-write
** correct values for the FORM, 8SVX and BODY chunks.
*/
} ;
return 0 ;
} /* sd2_close */
| Overflow | 0 | sd2_close (SF_PRIVATE *psf)
{
if (psf->file.mode == SFM_WRITE)
{ /* Now we know for certain the audio_length of the file we can re-write
** correct values for the FORM, 8SVX and BODY chunks.
*/
} ;
return 0 ;
} /* sd2_close */
| @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,868 | sd2_open (SF_PRIVATE *psf)
{ int subformat, error = 0, valid ;
/* SD2 is always big endian. */
psf->endian = SF_ENDIAN_BIG ;
if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->rsrclength > 0))
{ psf_use_rsrc (psf, SF_TRUE) ;
valid = psf_file_valid (psf) ;
psf_use_rsrc (psf, SF_FALSE) ;
if... | Overflow | 0 | sd2_open (SF_PRIVATE *psf)
{ int subformat, error = 0, valid ;
/* SD2 is always big endian. */
psf->endian = SF_ENDIAN_BIG ;
if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->rsrclength > 0))
{ psf_use_rsrc (psf, SF_TRUE) ;
valid = psf_file_valid (psf) ;
psf_use_rsrc (psf, SF_FALSE) ;
if... | @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,869 | sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length))
{ SD2_RSRC rsrc ;
STR_RSRC str_rsrc [] =
{ { RSRC_STR, 1000, "_sample-size", "", 0 },
{ RSRC_STR, 1001, "_sample-rate", "", 0 },
{ RSRC_STR, 1002, "_channels", "", 0 },
{ RSRC_BIN, 1000, "_Markers", "", 8 }
} ;
int k, str_offset, data_offset, n... | Overflow | 0 | sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length))
{ SD2_RSRC rsrc ;
STR_RSRC str_rsrc [] =
{ { RSRC_STR, 1000, "_sample-size", "", 0 },
{ RSRC_STR, 1001, "_sample-rate", "", 0 },
{ RSRC_STR, 1002, "_channels", "", 0 },
{ RSRC_BIN, 1000, "_Markers", "", 8 }
} ;
int k, str_offset, data_offset, n... | @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,870 | write_char (unsigned char * data, int offset, char value)
{ data [offset] = value ;
} /* write_char */
| Overflow | 0 | write_char (unsigned char * data, int offset, char value)
{ data [offset] = value ;
} /* write_char */
| @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,871 | write_int (unsigned char * data, int offset, int value)
{ data [offset] = value >> 24 ;
data [offset + 1] = value >> 16 ;
data [offset + 2] = value >> 8 ;
data [offset + 3] = value ;
} /* write_int */
| Overflow | 0 | write_int (unsigned char * data, int offset, int value)
{ data [offset] = value >> 24 ;
data [offset + 1] = value >> 16 ;
data [offset + 2] = value >> 8 ;
data [offset + 3] = value ;
} /* write_int */
| @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,872 | write_marker (unsigned char * data, int offset, int value)
{
if (CPU_IS_BIG_ENDIAN)
{ data [offset] = value >> 24 ;
data [offset + 1] = value >> 16 ;
data [offset + 2] = value >> 8 ;
data [offset + 3] = value ;
}
else
{ data [offset] = value ;
data [offset + 1] = value >> 8 ;
data [offset + 2] = value >... | Overflow | 0 | write_marker (unsigned char * data, int offset, int value)
{
if (CPU_IS_BIG_ENDIAN)
{ data [offset] = value >> 24 ;
data [offset + 1] = value >> 16 ;
data [offset + 2] = value >> 8 ;
data [offset + 3] = value ;
}
else
{ data [offset] = value ;
data [offset + 1] = value >> 8 ;
data [offset + 2] = value >... | @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,873 | write_str (unsigned char * data, int offset, const char * buffer, int buffer_len)
{ memcpy (data + offset, buffer, buffer_len) ;
} /* write_str */
| Overflow | 0 | write_str (unsigned char * data, int offset, const char * buffer, int buffer_len)
{ memcpy (data + offset, buffer, buffer_len) ;
} /* write_str */
| @@ -517,6 +517,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
rsrc.type_offset = rsrc.map_offset + 30 ;
+ if (rsrc.map_offset + 28 > rsrc.rsrc_len)
+ { psf_log_printf (psf, "Bad map offset.\n") ;
+ goto parse_rsrc_fork_cleanup ;
+ } ;
+
rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ;
if (... | CWE-119 | null | null |
36,874 | devzvol_close_zfs()
{
szcm = NULL;
szn2m = NULL;
(void) ldi_close(devzvol_lh, FREAD|FWRITE, kcred);
ldi_ident_release(devzvol_li);
if (zfs_mod != NULL) {
(void) ddi_modclose(zfs_mod);
zfs_mod = NULL;
}
}
| DoS | 0 | devzvol_close_zfs()
{
szcm = NULL;
szn2m = NULL;
(void) ldi_close(devzvol_lh, FREAD|FWRITE, kcred);
ldi_ident_release(devzvol_li);
if (zfs_mod != NULL) {
(void) ddi_modclose(zfs_mod);
zfs_mod = NULL;
}
}
| @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,875 | devzvol_create(struct vnode *dvp, char *nm, struct vattr *vap, vcexcl_t excl,
int mode, struct vnode **vpp, struct cred *cred, int flag,
caller_context_t *ct, vsecattr_t *vsecp)
{
int error;
struct vnode *vp;
*vpp = NULL;
error = devzvol_lookup(dvp, nm, &vp, NULL, 0, NULL, cred, ct, NULL,
NULL);
if ... | DoS | 0 | devzvol_create(struct vnode *dvp, char *nm, struct vattr *vap, vcexcl_t excl,
int mode, struct vnode **vpp, struct cred *cred, int flag,
caller_context_t *ct, vsecattr_t *vsecp)
{
int error;
struct vnode *vp;
*vpp = NULL;
error = devzvol_lookup(dvp, nm, &vp, NULL, 0, NULL, cred, ct, NULL,
NULL);
if ... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,876 | devzvol_create_link(struct sdev_node *ddv, char *nm,
void **arg, cred_t *cred, void *whatever, char *whichever)
{
minor_t minor;
char *pathname = (char *)*arg;
int rc;
char *dsname;
char *x;
char str[MAXNAMELEN];
sdcmn_err13(("create_link (%s) (%s) '%s'", ddv->sdev_name,
ddv->sdev_path, nm));
dsname = ... | DoS | 0 | devzvol_create_link(struct sdev_node *ddv, char *nm,
void **arg, cred_t *cred, void *whatever, char *whichever)
{
minor_t minor;
char *pathname = (char *)*arg;
int rc;
char *dsname;
char *x;
char str[MAXNAMELEN];
sdcmn_err13(("create_link (%s) (%s) '%s'", ddv->sdev_name,
ddv->sdev_path, nm));
dsname = ... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,877 | devzvol_create_pool_dirs(struct vnode *dvp)
{
zfs_cmd_t *zc;
nvlist_t *nv = NULL;
nvpair_t *elem = NULL;
size_t size;
int pools = 0;
int rc;
sdcmn_err13(("devzvol_create_pool_dirs"));
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
mutex_enter(&devzvol_mtx);
zc->zc_cookie = devzvol_gen;
rc = devzvol_handle... | DoS | 0 | devzvol_create_pool_dirs(struct vnode *dvp)
{
zfs_cmd_t *zc;
nvlist_t *nv = NULL;
nvpair_t *elem = NULL;
size_t size;
int pools = 0;
int rc;
sdcmn_err13(("devzvol_create_pool_dirs"));
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
mutex_enter(&devzvol_mtx);
zc->zc_cookie = devzvol_gen;
rc = devzvol_handle... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,878 | devzvol_handle_ioctl(int cmd, zfs_cmd_t *zc, size_t *alloc_size)
{
uint64_t cookie;
int size = 8000;
int unused;
int rc;
if (cmd != ZFS_IOC_POOL_CONFIGS)
mutex_enter(&devzvol_mtx);
if (!devzvol_isopen) {
if ((rc = devzvol_open_zfs()) == 0) {
devzvol_isopen = B_TRUE;
} else {
if (cmd != ZFS_IOC_POOL_C... | DoS | 0 | devzvol_handle_ioctl(int cmd, zfs_cmd_t *zc, size_t *alloc_size)
{
uint64_t cookie;
int size = 8000;
int unused;
int rc;
if (cmd != ZFS_IOC_POOL_CONFIGS)
mutex_enter(&devzvol_mtx);
if (!devzvol_isopen) {
if ((rc = devzvol_open_zfs()) == 0) {
devzvol_isopen = B_TRUE;
} else {
if (cmd != ZFS_IOC_POOL_C... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,879 | devzvol_lookup(struct vnode *dvp, char *nm, struct vnode **vpp,
struct pathname *pnp, int flags, struct vnode *rdir, struct cred *cred,
caller_context_t *ct, int *direntflags, pathname_t *realpnp)
{
enum vtype expected_type = VDIR;
struct sdev_node *parent = VTOSDEV(dvp);
char *dsname;
dmu_objset_type_t do_... | DoS | 0 | devzvol_lookup(struct vnode *dvp, char *nm, struct vnode **vpp,
struct pathname *pnp, int flags, struct vnode *rdir, struct cred *cred,
caller_context_t *ct, int *direntflags, pathname_t *realpnp)
{
enum vtype expected_type = VDIR;
struct sdev_node *parent = VTOSDEV(dvp);
char *dsname;
dmu_objset_type_t do_... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,880 | devzvol_make_dsname(const char *path, const char *name)
{
char *dsname;
const char *ptr;
int dslen;
if (strcmp(path, ZVOL_DIR) == 0)
return (NULL);
if (name && (strcmp(name, ".") == 0 || strcmp(name, "..") == 0))
return (NULL);
ptr = path + strlen(ZVOL_DIR);
if (strncmp(ptr, "/dsk", 4) == 0)
ptr += strlen... | DoS | 0 | devzvol_make_dsname(const char *path, const char *name)
{
char *dsname;
const char *ptr;
int dslen;
if (strcmp(path, ZVOL_DIR) == 0)
return (NULL);
if (name && (strcmp(name, ".") == 0 || strcmp(name, "..") == 0))
return (NULL);
ptr = path + strlen(ZVOL_DIR);
if (strncmp(ptr, "/dsk", 4) == 0)
ptr += strlen... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,881 | devzvol_open_zfs()
{
int rc;
dev_t dv;
devzvol_li = ldi_ident_from_anon();
if (ldi_open_by_name("/dev/zfs", FREAD | FWRITE, kcred,
&devzvol_lh, devzvol_li))
return (-1);
if (zfs_mod == NULL && ((zfs_mod = ddi_modopen("fs/zfs",
KRTLD_MODE_FIRST, &rc)) == NULL)) {
return (rc);
}
ASSERT(szcm == NULL ... | DoS | 0 | devzvol_open_zfs()
{
int rc;
dev_t dv;
devzvol_li = ldi_ident_from_anon();
if (ldi_open_by_name("/dev/zfs", FREAD | FWRITE, kcred,
&devzvol_lh, devzvol_li))
return (-1);
if (zfs_mod == NULL && ((zfs_mod = ddi_modopen("fs/zfs",
KRTLD_MODE_FIRST, &rc)) == NULL)) {
return (rc);
}
ASSERT(szcm == NULL ... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,882 | devzvol_prunedir(struct sdev_node *ddv)
{
struct sdev_node *dv;
ASSERT(RW_READ_HELD(&ddv->sdev_contents));
sdcmn_err13(("prunedir '%s'", ddv->sdev_name));
ASSERT(strncmp(ddv->sdev_path, ZVOL_DIR, strlen(ZVOL_DIR)) == 0);
if (rw_tryupgrade(&ddv->sdev_contents) == 0) {
rw_exit(&ddv->sdev_contents);
rw_enter(&d... | DoS | 0 | devzvol_prunedir(struct sdev_node *ddv)
{
struct sdev_node *dv;
ASSERT(RW_READ_HELD(&ddv->sdev_contents));
sdcmn_err13(("prunedir '%s'", ddv->sdev_name));
ASSERT(strncmp(ddv->sdev_path, ZVOL_DIR, strlen(ZVOL_DIR)) == 0);
if (rw_tryupgrade(&ddv->sdev_contents) == 0) {
rw_exit(&ddv->sdev_contents);
rw_enter(&d... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,883 | devzvol_validate(struct sdev_node *dv)
{
dmu_objset_type_t do_type;
char *dsname;
char *nm = dv->sdev_name;
int rc;
sdcmn_err13(("validating ('%s' '%s')", dv->sdev_path, nm));
/*
* validate only READY nodes; if someone is sitting on the
* directory of a dataset that just got destroyed we could
* get a zomb... | DoS | 0 | devzvol_validate(struct sdev_node *dv)
{
dmu_objset_type_t do_type;
char *dsname;
char *nm = dv->sdev_name;
int rc;
sdcmn_err13(("validating ('%s' '%s')", dv->sdev_path, nm));
/*
* validate only READY nodes; if someone is sitting on the
* directory of a dataset that just got destroyed we could
* get a zomb... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,884 | sdev_iter_datasets(struct vnode *dvp, int arg, char *name)
{
zfs_cmd_t *zc;
int rc;
sdcmn_err13(("iter name is '%s' (arg %x)", name, arg));
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
(void) strcpy(zc->zc_name, name);
while ((rc = devzvol_handle_ioctl(arg, zc, B_FALSE)) == 0) {
struct vnode *vpp;
char *... | DoS | 0 | sdev_iter_datasets(struct vnode *dvp, int arg, char *name)
{
zfs_cmd_t *zc;
int rc;
sdcmn_err13(("iter name is '%s' (arg %x)", name, arg));
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
(void) strcpy(zc->zc_name, name);
while ((rc = devzvol_handle_ioctl(arg, zc, B_FALSE)) == 0) {
struct vnode *vpp;
char *... | @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,885 | sdev_iter_snapshots(struct vnode *dvp, char *name)
{
sdev_iter_datasets(dvp, ZFS_IOC_SNAPSHOT_LIST_NEXT, name);
}
| DoS | 0 | sdev_iter_snapshots(struct vnode *dvp, char *name)
{
sdev_iter_datasets(dvp, ZFS_IOC_SNAPSHOT_LIST_NEXT, name);
}
| @@ -792,7 +792,10 @@ devzvol_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred,
return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
}
- ptr = strchr(ptr + 1, '/') + 1;
+ ptr = strchr(ptr + 1, '/');
+ if (ptr == NULL)
+ return (ENOENT);
+ ptr++;
rw_exit(&sdvp->sdev_contents);
sdev_iter_data... | null | null | null |
36,886 | static void batadv_frag_clear_chain(struct hlist_head *head)
{
struct batadv_frag_list_entry *entry;
struct hlist_node *node;
hlist_for_each_entry_safe(entry, node, head, list) {
hlist_del(&entry->list);
kfree_skb(entry->skb);
kfree(entry);
}
}
| DoS | 0 | static void batadv_frag_clear_chain(struct hlist_head *head)
{
struct batadv_frag_list_entry *entry;
struct hlist_node *node;
hlist_for_each_entry_safe(entry, node, head, list) {
hlist_del(&entry->list);
kfree_skb(entry->skb);
kfree(entry);
}
}
| @@ -251,7 +251,7 @@ batadv_frag_merge_packets(struct hlist_head *chain, struct sk_buff *skb)
kfree(entry);
/* Make room for the rest of the fragments. */
- if (pskb_expand_head(skb_out, 0, size - skb->len, GFP_ATOMIC) < 0) {
+ if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) {
kfree_skb(s... | CWE-399 | null | null |
36,887 | static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
struct sk_buff *skb,
struct hlist_head *chain_out)
{
struct batadv_frag_table_entry *chain;
struct batadv_frag_list_entry *frag_entry_new = NULL, *frag_entry_curr;
struct batadv_frag_list_entry *frag_entry_last = NULL;
str... | DoS | 0 | static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
struct sk_buff *skb,
struct hlist_head *chain_out)
{
struct batadv_frag_table_entry *chain;
struct batadv_frag_list_entry *frag_entry_new = NULL, *frag_entry_curr;
struct batadv_frag_list_entry *frag_entry_last = NULL;
str... | @@ -251,7 +251,7 @@ batadv_frag_merge_packets(struct hlist_head *chain, struct sk_buff *skb)
kfree(entry);
/* Make room for the rest of the fragments. */
- if (pskb_expand_head(skb_out, 0, size - skb->len, GFP_ATOMIC) < 0) {
+ if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) {
kfree_skb(s... | CWE-399 | null | null |
36,888 | void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,
bool (*check_cb)(struct batadv_frag_table_entry *))
{
struct batadv_frag_table_entry *chain;
uint8_t i;
for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) {
chain = &orig_node->fragments[i];
spin_lock_bh(&orig_node->fragments[i].lock);
if (!c... | DoS | 0 | void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,
bool (*check_cb)(struct batadv_frag_table_entry *))
{
struct batadv_frag_table_entry *chain;
uint8_t i;
for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) {
chain = &orig_node->fragments[i];
spin_lock_bh(&orig_node->fragments[i].lock);
if (!c... | @@ -251,7 +251,7 @@ batadv_frag_merge_packets(struct hlist_head *chain, struct sk_buff *skb)
kfree(entry);
/* Make room for the rest of the fragments. */
- if (pskb_expand_head(skb_out, 0, size - skb->len, GFP_ATOMIC) < 0) {
+ if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) {
kfree_skb(s... | CWE-399 | null | null |
36,889 | static int batadv_frag_size_limit(void)
{
int limit = BATADV_FRAG_MAX_FRAG_SIZE;
limit -= sizeof(struct batadv_frag_packet);
limit *= BATADV_FRAG_MAX_FRAGMENTS;
return limit;
}
| DoS | 0 | static int batadv_frag_size_limit(void)
{
int limit = BATADV_FRAG_MAX_FRAG_SIZE;
limit -= sizeof(struct batadv_frag_packet);
limit *= BATADV_FRAG_MAX_FRAGMENTS;
return limit;
}
| @@ -251,7 +251,7 @@ batadv_frag_merge_packets(struct hlist_head *chain, struct sk_buff *skb)
kfree(entry);
/* Make room for the rest of the fragments. */
- if (pskb_expand_head(skb_out, 0, size - skb->len, GFP_ATOMIC) < 0) {
+ if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) {
kfree_skb(s... | CWE-399 | null | null |
36,890 | badauth(OM_uint32 maj, OM_uint32 minor, SVCXPRT *xprt)
{
if (log_badauth != NULL)
(*log_badauth)(maj, minor, &xprt->xp_raddr, log_badauth_data);
if (log_badauth2 != NULL)
(*log_badauth2)(maj, minor, xprt, log_badauth2_data);
}
| +Info | 0 | badauth(OM_uint32 maj, OM_uint32 minor, SVCXPRT *xprt)
{
if (log_badauth != NULL)
(*log_badauth)(maj, minor, &xprt->xp_raddr, log_badauth_data);
if (log_badauth2 != NULL)
(*log_badauth2)(maj, minor, xprt, log_badauth2_data);
}
| @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
36,891 | svcauth_gss_destroy(SVCAUTH *auth)
{
struct svc_rpc_gss_data *gd;
OM_uint32 min_stat;
log_debug("in svcauth_gss_destroy()");
gd = SVCAUTH_PRIVATE(auth);
gss_delete_sec_context(&min_stat, &gd->ctx, GSS_C_NO_BUFFER);
gss_release_buffer(&min_stat, &gd->cname);
gss_release_buffer(&min_stat, &gd->checksum);
if... | +Info | 0 | svcauth_gss_destroy(SVCAUTH *auth)
{
struct svc_rpc_gss_data *gd;
OM_uint32 min_stat;
log_debug("in svcauth_gss_destroy()");
gd = SVCAUTH_PRIVATE(auth);
gss_delete_sec_context(&min_stat, &gd->ctx, GSS_C_NO_BUFFER);
gss_release_buffer(&min_stat, &gd->cname);
gss_release_buffer(&min_stat, &gd->checksum);
if... | @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
36,892 | svcauth_gss_get_principal(SVCAUTH *auth)
{
struct svc_rpc_gss_data *gd;
char *pname;
gd = SVCAUTH_PRIVATE(auth);
if (gd->cname.length == 0 || gd->cname.length >= SIZE_MAX)
return (NULL);
if ((pname = malloc(gd->cname.length + 1)) == NULL)
return (NULL);
memcpy(pname, gd->cname.value, gd->cname.length);
p... | +Info | 0 | svcauth_gss_get_principal(SVCAUTH *auth)
{
struct svc_rpc_gss_data *gd;
char *pname;
gd = SVCAUTH_PRIVATE(auth);
if (gd->cname.length == 0 || gd->cname.length >= SIZE_MAX)
return (NULL);
if ((pname = malloc(gd->cname.length + 1)) == NULL)
return (NULL);
memcpy(pname, gd->cname.value, gd->cname.length);
p... | @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
36,893 | svcauth_gss_nextverf(struct svc_req *rqst, u_int num)
{
struct svc_rpc_gss_data *gd;
gss_buffer_desc signbuf;
OM_uint32 maj_stat, min_stat;
log_debug("in svcauth_gss_nextverf()");
if (rqst->rq_xprt->xp_auth == NULL)
return (FALSE);
gd = SVCAUTH_PRIVATE(rqst->rq_xprt->xp_auth);
gss_release_buffer(&min_s... | +Info | 0 | svcauth_gss_nextverf(struct svc_req *rqst, u_int num)
{
struct svc_rpc_gss_data *gd;
gss_buffer_desc signbuf;
OM_uint32 maj_stat, min_stat;
log_debug("in svcauth_gss_nextverf()");
if (rqst->rq_xprt->xp_auth == NULL)
return (FALSE);
gd = SVCAUTH_PRIVATE(rqst->rq_xprt->xp_auth);
gss_release_buffer(&min_s... | @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
36,894 | svcauth_gss_release_cred(void)
{
OM_uint32 maj_stat, min_stat;
log_debug("in svcauth_gss_release_cred()");
maj_stat = gss_release_cred(&min_stat, &svcauth_gss_creds);
if (maj_stat != GSS_S_COMPLETE) {
log_status("gss_release_cred", maj_stat, min_stat);
return (FALSE);
}
svcauth_gss_creds = NULL;
return ... | +Info | 0 | svcauth_gss_release_cred(void)
{
OM_uint32 maj_stat, min_stat;
log_debug("in svcauth_gss_release_cred()");
maj_stat = gss_release_cred(&min_stat, &svcauth_gss_creds);
if (maj_stat != GSS_S_COMPLETE) {
log_status("gss_release_cred", maj_stat, min_stat);
return (FALSE);
}
svcauth_gss_creds = NULL;
return ... | @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
36,895 | svcauth_gss_set_log_badauth2_func(auth_gssapi_log_badauth2_func func,
caddr_t data)
{
log_badauth2 = func;
log_badauth2_data = data;
}
| +Info | 0 | svcauth_gss_set_log_badauth2_func(auth_gssapi_log_badauth2_func func,
caddr_t data)
{
log_badauth2 = func;
log_badauth2_data = data;
}
| @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
36,896 | void svcauth_gss_set_log_badauth_func(
auth_gssapi_log_badauth_func func,
caddr_t data)
{
log_badauth = func;
log_badauth_data = data;
}
| +Info | 0 | void svcauth_gss_set_log_badauth_func(
auth_gssapi_log_badauth_func func,
caddr_t data)
{
log_badauth = func;
log_badauth_data = data;
}
| @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
36,897 | void svcauth_gss_set_log_miscerr_func(
auth_gssapi_log_miscerr_func func,
caddr_t data)
{
log_miscerr = func;
log_miscerr_data = data;
}
| +Info | 0 | void svcauth_gss_set_log_miscerr_func(
auth_gssapi_log_miscerr_func func,
caddr_t data)
{
log_miscerr = func;
log_miscerr_data = data;
}
| @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
36,898 | svcauth_gss_set_svc_name(gss_name_t name)
{
OM_uint32 maj_stat, min_stat;
log_debug("in svcauth_gss_set_svc_name()");
if (svcauth_gss_name != NULL) {
maj_stat = gss_release_name(&min_stat, &svcauth_gss_name);
if (maj_stat != GSS_S_COMPLETE) {
log_status("gss_release_name", maj_stat, min_stat);
return (F... | +Info | 0 | svcauth_gss_set_svc_name(gss_name_t name)
{
OM_uint32 maj_stat, min_stat;
log_debug("in svcauth_gss_set_svc_name()");
if (svcauth_gss_name != NULL) {
maj_stat = gss_release_name(&min_stat, &svcauth_gss_name);
if (maj_stat != GSS_S_COMPLETE) {
log_status("gss_release_name", maj_stat, min_stat);
return (F... | @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
36,899 | svcauth_gss_unwrap(SVCAUTH *auth, XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr)
{
struct svc_rpc_gss_data *gd;
log_debug("in svcauth_gss_unwrap()");
gd = SVCAUTH_PRIVATE(auth);
if (!gd->established || gd->sec.svc == RPCSEC_GSS_SVC_NONE) {
return ((*xdr_func)(xdrs, xdr_ptr));
}
return (xdr_rpc_gss_data(xdrs... | +Info | 0 | svcauth_gss_unwrap(SVCAUTH *auth, XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr)
{
struct svc_rpc_gss_data *gd;
log_debug("in svcauth_gss_unwrap()");
gd = SVCAUTH_PRIVATE(auth);
if (!gd->established || gd->sec.svc == RPCSEC_GSS_SVC_NONE) {
return ((*xdr_func)(xdrs, xdr_ptr));
}
return (xdr_rpc_gss_data(xdrs... | @@ -65,16 +65,6 @@ extern const gss_OID_desc * const gss_mech_spkm3;
extern SVCAUTH svc_auth_none;
-/*
- * from mit-krb5-1.2.1 mechglue/mglueP.h:
- * Array of context IDs typed by mechanism OID
- */
-typedef struct gss_union_ctx_id_t {
- gss_OID mech_type;
- gss_ctx_id_t internal_ctx_id;
-} gss_union_ctx_... | CWE-200 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.