aboutsummaryrefslogtreecommitdiffstats
path: root/common/iobuf.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* common: Avoid undefined behavior.Justus Winter2017-03-301-1/+1
| | | | | | | * common/iobuf.c (iobuf_read_line): Do not consider 'length' if 'buffer' is NULL. Signed-off-by: Justus Winter <[email protected]>
* Clean up word replication.Yuri Chornoivan2017-02-211-1/+1
| | | | | | | | | -- This fixes extra word repetitions (like "the the" or "is is") in the code and docs. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg,sm: Merge the two versions of check_special_filename.Werner Koch2016-11-291-33/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * sm/gpgsm.c (check_special_filename): Move to .. * common/sysutils.c (check_special_filename): here. Add arg NOTRANSLATE. (allow_special_filenames): New local var. (enable_special_filenames): New public functions. * sm/gpgsm.c (allow_special_filenames): Remove var. (main): Call enable_special_filenames instead of setting the var. (open_read, open_es_fread, open_es_fwrite): Call check_special_filename with 0 for NOTRANSLATE. * common/iobuf.c (special_names_enabled): Remove var. (iobuf_enable_special_filenames): Remove func. (check_special_filename): Remove func. (iobuf_is_pipe_filename): Call new version of the function with NOTRANSLATE set. (do_open): Ditto. * g10/gpg.c (main): Call enable_special_filenames instead of iobuf_enable_special_filenames. * g10/gpgv.c (main): Ditto. -- Note that we keep the iobuf.c:translate_file_handle because it is a bit different (for whatever reasons) than the translate function from sysutils. Signed-off-by: Werner Koch <[email protected]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* More cleanup of "allow to".Daniel Kahn Gillmor2016-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | * README, agent/command.c, agent/keyformat.txt, common/i18n.c, common/iobuf.c, common/keyserver.h, dirmngr/cdblib.c, dirmngr/ldap-wrapper.c, doc/DETAILS, doc/TRANSLATE, doc/announce-2.1.txt, doc/gpg.texi, doc/gpgsm.texi, doc/scdaemon.texi, doc/tools.texi, doc/whats-new-in-2.1.txt, g10/export.c, g10/getkey.c, g10/import.c, g10/keyedit.c, m4/ksba.m4, m4/libgcrypt.m4, m4/ntbtls.m4, po/ca.po, po/cs.po, po/da.po, po/de.po, po/el.po, po/eo.po, po/es.po, po/et.po, po/fi.po, po/fr.po, po/gl.po, po/hu.po, po/id.po, po/it.po, po/ja.po, po/nb.po, po/pl.po, po/pt.po, po/ro.po, po/ru.po, po/sk.po, po/sv.po, po/tr.po, po/uk.po, po/zh_CN.po, po/zh_TW.po, scd/app-p15.c, scd/ccid-driver.c, scd/command.c, sm/gpgsm.c, sm/sign.c, tools/gpgconf-comp.c, tools/gpgtar.h: replace "Allow to" with clearer text. In standard English, the normal construction is "${XXX} allows ${YYY} to" -- that is, the subject (${XXX}) of the sentence is allowing the object (${YYY}) to do something. When the object is missing, the phrasing sounds awkward, even if the object is implied by context. There's almost always a better construction that isn't as awkward. These changes should make the language a bit clearer. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* common: Fix iobuf_peek corner case.Justus Winter2016-07-261-3/+15
| | | | | | | | | | | | | | | Previously, iobuf_peek on a file smaller than 'buflen' would hang. * common/iobuf.c (underflow): Generalize by adding a target parameter. (iobuf_peek): Use this to prevent looping here. * tests/openpgp/Makefile.am (TESTS): Add new test. * tests/openpgp/setup.scm (dearmor): Move function... * tests/openpgp/defs.scm (dearmor): ... here. * tests/openpgp/issue2419.scm: New file. * tests/openpgp/samplemsgs/issue2419.asc: Likewise. GnuPG-bug-id: 2419 Signed-off-by: Justus Winter <[email protected]>
* common: Fix memory leak.Justus Winter2016-06-301-3/+2
| | | | | | | * common/iobuf.c (iobuf_set_partial_body_length_mode): Only create context if necessary. Signed-off-by: Justus Winter <[email protected]>
* gpg: Rename pop_filter to iobuf_pop_filter and export it.Neal H. Walfield2016-03-021-11/+12
| | | | | | | | * common/iobuf.c (pop_filter): Rename from this... (iobuf_pop_filter): ... to this. Don't mark it as static. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: Reduce buffer size.Neal H. Walfield2016-02-231-2/+2
| | | | | | | | | | * common/iobuf.c (iobuf_copy): Change buffer size from 1 MB to 32 KB. -- Change suggested by Werner based on the observation that other buffers are of a similar size. Signed-off-by: Neal H. Walfield <[email protected]>
* common: Improve a function's documentation and comments.Neal H. Walfield2016-02-231-10/+14
| | | | | | | | * common/iobuf.c (iobuf_set_partial_body_length_mode): Fix documentation and comment. Add an assert. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Use higher-level functions.Neal H. Walfield2016-02-231-0/+3
| | | | | | | | | | * g10/build-packet.c (do_symkey_enc): Use iobuf_write instead of iobuf_put in a loop. Use iobuf_copy instead of iobuf_read and iobuf_write in a loop. Move the memory wiping from here... * common/iobuf.c (iobuf_copy): ... to here. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: Check for an error before reading.Neal H. Walfield2016-02-231-0/+3
| | | | | | | | * common/iobuf.c (iobuf_copy): If DEST has a pending error, don't start copying. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: More accurately name function.Neal H. Walfield2016-02-231-1/+1
| | | | | | | | * common/iobuf.c (iobuf_set_partial_block_mode): Rename from this... (iobuf_set_partial_body_length_mode): ... to this. Update callers. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common, g10: Fix indentation to silence GCC-6.NIIBE Yutaka2016-02-151-5/+5
| | | | | | | | | | * common/iobuf.c (iobuf_ioctl): Fix. * g10/encrypt.c (encrypt_filter): Likewise. * g10/keyring.c (prepare_search): Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common: Fix comment.Neal H. Walfield2016-02-141-1/+1
| | | | | | | * common/iobuf.c (iobuf_flush_temp): Fix comment. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: Fix iobuf API of filter function for alignment.NIIBE Yutaka2016-01-121-20/+32
| | | | | | | | | | | | | | | | | | | | | * common/iobuf.h (IOBUFCTRL_DESC): Change the call semantics. * common/iobuf.c (iobuf_desc): Add the second argument DESC. (print_chain, iobuf_close, do_open, iobuf_sockopen, iobuf_ioctl) (iobuf_push_filter2, pop_filter, iobuf_write_temp): Change calls of iobuf_desc. (file_filter, file_es_filter, sock_filter, block_filter): Fill the description. * common/t-iobuf.c (every_other_filter, double_filter): Likewise. * g10/armor.c, g10/cipher.c, g10/compress-bz2.c, g10/compress.c, g10/decrypt-data.c, g10/encrypt.c, g10/mdfilter.c, g10/progress.c, g10/textfilter.c: Likewise. -- Newer GCC warns against possible alignment difference of pointers. This change can silence those warnings. Signed-off-by: NIIBE Yutaka <[email protected]>
* common: Avoid warnings about useless assignments.Werner Koch2016-01-061-1/+0
| | | | | | | | | | * common/b64enc.c (b64enc_finish): Remove var assignment which is not used later. * common/iobuf.c (file_filter): Ditto. * common/tlv.c (do_find_tlv): Ditto. * common/userids.c (classify_user_id): Ditto. Signed-off-by: Werner Koch <[email protected]>
* Silence unused variable or parameter warnings.Werner Koch2015-11-271-7/+10
| | | | --
* common: Avoid undefined behavior.Justus Winter2015-11-191-1/+1
| | | | | | | | | * common/iobuf.c (iobuf_esopen): Initialize 'len' as 'file_es_filter' will make use of it. -- Found using the Clang Static Analyzer. Signed-off-by: Justus Winter <[email protected]>
* Fix typos found using codespell.Justus Winter2015-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/cache.c: Fix typos. * agent/call-pinentry.c: Likewise. * agent/call-scd.c: Likewise. * agent/command-ssh.c: Likewise. * agent/command.c: Likewise. * agent/divert-scd.c: Likewise. * agent/findkey.c: Likewise. * agent/gpg-agent.c: Likewise. * agent/w32main.c: Likewise. * common/argparse.c: Likewise. * common/audit.c: Likewise. * common/audit.h: Likewise. * common/convert.c: Likewise. * common/dotlock.c: Likewise. * common/exechelp-posix.c: Likewise. * common/exechelp-w32.c: Likewise. * common/exechelp-w32ce.c: Likewise. * common/exechelp.h: Likewise. * common/helpfile.c: Likewise. * common/i18n.h: Likewise. * common/iobuf.c: Likewise. * common/iobuf.h: Likewise. * common/localename.c: Likewise. * common/logging.c: Likewise. * common/openpgp-oid.c: Likewise. * common/session-env.c: Likewise. * common/sexputil.c: Likewise. * common/sysutils.c: Likewise. * common/t-sexputil.c: Likewise. * common/ttyio.c: Likewise. * common/util.h: Likewise. * dirmngr/cdblib.c: Likewise. * dirmngr/certcache.c: Likewise. * dirmngr/crlcache.c: Likewise. * dirmngr/dirmngr-client.c: Likewise. * dirmngr/dirmngr.c: Likewise. * dirmngr/dirmngr_ldap.c: Likewise. * dirmngr/dns-stuff.c: Likewise. * dirmngr/http.c: Likewise. * dirmngr/ks-engine-hkp.c: Likewise. * dirmngr/ks-engine-ldap.c: Likewise. * dirmngr/ldap-wrapper.c: Likewise. * dirmngr/ldap.c: Likewise. * dirmngr/misc.c: Likewise. * dirmngr/ocsp.c: Likewise. * dirmngr/validate.c: Likewise. * g10/encrypt.c: Likewise. * g10/getkey.c: Likewise. * g10/gpg.c: Likewise. * g10/gpgv.c: Likewise. * g10/import.c: Likewise. * g10/keydb.c: Likewise. * g10/keydb.h: Likewise. * g10/keygen.c: Likewise. * g10/keyid.c: Likewise. * g10/keylist.c: Likewise. * g10/keyring.c: Likewise. * g10/mainproc.c: Likewise. * g10/misc.c: Likewise. * g10/options.h: Likewise. * g10/packet.h: Likewise. * g10/parse-packet.c: Likewise. * g10/pkclist.c: Likewise. * g10/pkglue.c: Likewise. * g10/plaintext.c: Likewise. * g10/server.c: Likewise. * g10/sig-check.c: Likewise. * g10/sqlite.c: Likewise. * g10/tdbio.c: Likewise. * g10/test-stubs.c: Likewise. * g10/tofu.c: Likewise. * g10/trust.c: Likewise. * g10/trustdb.c: Likewise. * g13/create.c: Likewise. * g13/mountinfo.c: Likewise. * kbx/keybox-blob.c: Likewise. * kbx/keybox-file.c: Likewise. * kbx/keybox-init.c: Likewise. * kbx/keybox-search-desc.h: Likewise. * kbx/keybox-search.c: Likewise. * kbx/keybox-update.c: Likewise. * scd/apdu.c: Likewise. * scd/app-openpgp.c: Likewise. * scd/app-p15.c: Likewise. * scd/app.c: Likewise. * scd/ccid-driver.c: Likewise. * scd/command.c: Likewise. * scd/iso7816.c: Likewise. * sm/base64.c: Likewise. * sm/call-agent.c: Likewise. * sm/call-dirmngr.c: Likewise. * sm/certchain.c: Likewise. * sm/gpgsm.c: Likewise. * sm/import.c: Likewise. * sm/keydb.c: Likewise. * sm/minip12.c: Likewise. * sm/qualified.c: Likewise. * sm/server.c: Likewise. * tools/gpg-check-pattern.c: Likewise. * tools/gpgconf-comp.c: Likewise. * tools/gpgkey2ssh.c: Likewise. * tools/gpgparsemail.c: Likewise. * tools/gpgtar.c: Likewise. * tools/rfc822parse.c: Likewise. * tools/symcryptrun.c: Likewise. Signed-off-by: Justus Winter <[email protected]>
* common: Add a function for copying data from one iobuf to another.Neal H. Walfield2015-11-051-0/+35
| | | | | | | * common/iobuf.c (iobuf_copy): New function. -- Signed-off-by: Neal H. Walfield <[email protected]>
* iobuf: Add the IOBUF_INPUT_TEMP type to improve input temp handling.Neal H. Walfield2015-09-021-17/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/iobuf.h (enum iobuf_use): Add new member, IOBUF_INPUT_TEMP. * common/iobuf.c (iobuf_temp_with_content): Create the iobuf as an IOBUF_INPUT_TEMP, not an IOBUF_INPUT buffer. Assert that LENGTH == A->D.SIZE. (iobuf_push_filter2): If A is an IOBUF_INPUT_TEMP, then make the new filter an IOBUF_INPUT filter and set its buffer size to IOBUF_BUFFER_SIZE. (underflow): If A is an IOBUF_INPUT_TEMP, then just return EOF; don't remove already read data. (iobuf_seek): If A is an IOBUF_INPUT_TEMP, don't discard the buffered data. (iobuf_alloc): Allow USE == IOBUF_INPUT_TEMP. (pop_filter): Allow USE == IOBUF_INPUT_TEMP. (iobuf_peek): Allow USE == IOBUF_INPUT_TEMP. (iobuf_writebyte): Fail if USE == IOBUF_INPUT_TEMP. (iobuf_write): Fail if USE == IOBUF_INPUT_TEMP. (iobuf_writestr): Fail if USE == IOBUF_INPUT_TEMP. (iobuf_flush_temp): Fail if USE == IOBUF_INPUT_TEMP. -- Signed-off-by: Neal H. Walfield <[email protected]>. Introduce a new iobuf type, IOBUF_INPUT_TEMP. Use this for the iobuf created by iobuf_temp_with_content instead of IOBUF_INPUT. This was necessary so that seeking and peeking correctly work on this type of iobuf. In particular, seeking didn't work because we discarded the buffered data and peeking didn't work because we discarded data which was already read, which made seeking later impossible.
* iobuf: Rename IOBUF_TEMP to IOBUF_OUTPUT_TEMP.Neal H. Walfield2015-09-021-17/+25
| | | | | | | | * common/iobuf.h (enum iobuf_use): Rename IOBUF_TEMP to IOBUF_OUTPUT_TEMP. Update users. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Make control flow more obvious.Neal H. Walfield2015-08-201-73/+79
| | | | | | | | | | * common/iobuf.c (iobuf_read): Make control flow more obvious. (iobuf_get_filelength): Likewise. (iobuf_get_fd): Likewise. (iobuf_seek): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Add some sanity checks to catch programmer bugs.Neal H. Walfield2015-08-201-0/+42
| | | | | | | | | | | | | * common/iobuf.c (iobuf_alloc): Check that BUFSIZE is not 0. (iobuf_readbyte): Check that A is an input filter. Check that the amount of read data is at most the amount of buffered data. (iobuf_read): Check that A is an input filter. (iobuf_writebyte): Check that A is not an input filter. (iobuf_writestr): Check that A is not an input filter. (iobuf_flush_temp): Check that A is not an input filter. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c:iobuf_write_temp: Elide redundant code.Neal H. Walfield2015-08-201-4/+6
| | | | | | | | * common/iobuf.c (iobuf_write_temp): Don't repeat iobuf_flush_temp. Use it directly. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Have iobuf_writestr use iobuf_write, not iobuf_writebyteNeal H. Walfield2015-08-201-6/+1
| | | | | | | | * common/iobuf.c (iobuf_write): Don't write a byte at a time. Use iobuf_write. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf: Improve documentation and code comments.Neal H. Walfield2015-08-201-112/+80
| | | | | | | | common/iobuf.h: Improve documentation and code comments. common/iobuf.c: Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Adjust buffer size of filters in front of temp filters.Neal H. Walfield2015-08-201-2/+15
| | | | | | | | * common/iobuf.c (iobuf_push_filter2): If the head filter is a temp filter, use IOBUF_BUFFER_SIZE for the new filter. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Buffered data should not be processed by new filters.Neal H. Walfield2015-08-201-14/+15
| | | | | | | | | | | | * common/iobuf.c (iobuf_push_filter2): If the pipeline is an output or temp pipeline, the new filter shouldn't assume ownership of the old head's internal buffer: the data was written before the filter was added. * common/t-iobuf.c (double_filter): New function. (main): Add test cases for the above bug. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Flush the pipeline in iobuf_temp_to_buffer.Neal H. Walfield2015-08-201-1/+13
| | | | | | | | | * common/iobuf.c (iobuf_temp_to_buffer): Flush each filter in the pipeline and copy the data from the last (not the first) filter's internal buffer. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Combine iobuf_open, iobuf_create and iobuf_openrw.Neal H. Walfield2015-08-201-86/+55
| | | | | | | | | | * common/iobuf.c (do_open): New function, which is a generalization of iobuf_open, iobuf_Create, iobuf_openrw. (iobuf_open): Call do_open. (iobuf_create): Likewise. (iobuf_openrw): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.h: Remove iobuf_open_fd_or_name.Neal H. Walfield2015-08-201-17/+0
| | | | | | | | * common/iobuf.h (iobuf_open_fd_or_name): Remove prototype. Replace use with either iobuf_open or iobuf_fdopen_nc, as appropriate. * common/iobuf.c (iobuf_open): Remove function. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Rename iobuf_flush and make it a static function.Neal H. Walfield2015-08-201-16/+25
| | | | | | | | | | | * common/iobuf.h (iobuf_flush): Remove prototype. * common/iobuf.c (filter_flush): New static prototype. (iobuf_flush): Rename... (filter_flush): ... to this. Make static. Simplify code. Update callers. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Don't abort freeing a pipeline if freeing a filter failsNeal H. Walfield2015-08-201-5/+13
| | | | | | | | | * common/iobuf.c (iobuf_cancel): Don't abort freeing a pipeline if freeing a filter fails. This needs to a memory leak. Instead, keep freeing and return the error code of the first filter that fails. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Improve iobuf_peek.Neal H. Walfield2015-08-201-17/+33
| | | | | | | | | | | * common/iobuf.c (underflow): Take additional parameter clear_pending_eof. If not set, don't clear a pending eof when returning EOF. Update callers. (iobuf_peek): Fill the internal buffer, if needed, to be able to better satisfy any request. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: When requested, fill the buffer even if it is not empty.Neal H. Walfield2015-08-201-46/+92
| | | | | | | | * common/iobuf.c (underflow): Don't require that the buffer be empty. When called, fill any available space. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Better respect boundary conditions in iobuf_read_line.Neal H. Walfield2015-08-201-20/+41
| | | | | | | | | | | | * common/iobuf.c (iobuf_read_line): Be more careful with boundary conditions. * common/iobuf.h: Include <gpg-error.h>. * common/t-iobuf.c: New file. * common/Makefile.am (module_tests): Add t-iobuf. (t_mbox_util_LDADD): New variable. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Fix filter type for iobuf_temp_with_content.Neal H. Walfield2015-08-201-1/+1
| | | | | | | | | * common/iobuf.c (iobuf_temp_with_content): Set the filter type to IOBUF_INPUT, not IOBUF_TEMP, which is only for output filters that write into a dynamic buffer. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Refactor code to not need the desc field.Neal H. Walfield2015-08-201-30/+29
| | | | | | | | | * common/iobuf.h (struct iobuf_struct): Remove field desc. * common/iobuf.c (iobuf_desc): New function. When a filter's description is needed, use this instead of the filter's desc field. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.h: Clarify semantics of nofast. Simplify implementation.Neal H. Walfield2015-08-201-4/+4
| | | | | | | | * common/iobuf.h (struct iobuf_struct): Clarify semantics of nofast. Simplify use of nofast to implement just these semantics. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Remove dead code (directfp).Neal H. Walfield2015-08-201-64/+1
| | | | | | | | * common/iobuf.h (struct iobuf_struct): Remove field directfp. Remove all uses of it. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Remove dead code (opaque).Neal H. Walfield2015-08-201-2/+1
| | | | | | | | * common/iobuf.h (struct iobuf_struct): Remove field opaque. Remove all uses of it. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.h: Replace further use of literals with symbolic constants.Neal H. Walfield2015-08-201-38/+31
| | | | | | | | | | | * common/iobuf.c: Move BLOCK_FILTER_INPUT, BLOCK_FILTER_OUTPUT_BLOCK_FILTER_TEMP from here... * common/iobuf.h: ... to here and rename to IOBUF_INPUT, IOBUF_OUTPUT and IOBUF_TEMP, respectively. Where appropriate, use these macros instead of a literal. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Replace use of literals with symbolic constants.Neal H. Walfield2015-08-081-22/+38
| | | | | | | | | | * common/iobuf.c (BLOCK_FILTER_INPUT): Define. Where appropriate, use this instead of a literal. (BLOCK_FILTER_OUTPUT): Likewise. (BLOCK_FILTER_TEMP): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* Use inline functions to convert buffer data to scalars.Werner Koch2015-02-111-2/+5
| | | | | | | | | | | | | | | * common/host2net.h (buf16_to_ulong, buf16_to_uint): New. (buf16_to_ushort, buf16_to_u16): New. (buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New. -- Commit 91b826a38880fd8a989318585eb502582636ddd8 was not enough to avoid all sign extension on shift problems. Hanno Böck found a case with an invalid read due to this problem. To fix that once and for all almost all uses of "<< 24" and "<< 8" are changed by this patch to use an inline function from host2net.h. Signed-off-by: Werner Koch <[email protected]>
* avoid future chance of using uninitialized memoryDaniel Kahn Gillmor2014-12-221-1/+1
| | | | | | | | | | | | | | | | | | | | * common/iobuf.c: (iobuf_open): initialize len -- In iobuf_open, IOBUFCTRL_DESC and IOBUFCTRL_INIT commands are invoked (via file_filter()) on fcx, passing in a pointer to an uninitialized len. With these two commands, file_filter doesn't actually do anything with the value of len, so there's no actual risk of use of uninitialized memory in the code as it stands. However, some static analysis tools might flag this situation with a warning, and initializing the value doesn't hurt anything, so i think this trivial cleanup is warranted. Debian-Bug-Id: 773469
* gpg: Create exported secret files and revocs with mode 700.Werner Koch2014-06-301-7/+11
| | | | | | | | | | | | | | | * common/iobuf.c (direct_open): Add arg MODE700. (iobuf_create): Ditto. * g10/openfile.c (open_outfile): Add arg RESTRICTEDPERM. Change call callers to pass 0 for it. * g10/revoke.c (gen_desig_revoke, gen_revoke): Here pass true for new arg. * g10/export.c (do_export): Pass true for new arg if SECRET is true. -- GnuPG-bug-id: 1653. Note that this works only if --output has been used.
* common: Minor code cleanup for a legacy OS.Werner Koch2014-06-301-8/+7
| | | | * common/iobuf.c (direct_open) [__riscos__]: Simply cpp conditionals.
* w32: Include winsock2.h to silence warnings.Werner Koch2014-03-071-0/+3
|